Compare commits
2 Commits
76ea118bf2
...
9b36e46674
Author | SHA1 | Date | |
---|---|---|---|
9b36e46674 | |||
5a7f2abab9 |
9
bin/eufonctl.sh
Executable file
9
bin/eufonctl.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
SOCAT=socat
|
||||||
|
display=$1
|
||||||
|
test -n "$display" || display=$WAYLAND_DISPLAY
|
||||||
|
test -n "$display" || display=wayland-0
|
||||||
|
|
||||||
|
socket_name="${XDG_RUNTIME_DIR}/kiwmi-repl.${display}.socket"
|
||||||
|
|
||||||
|
${SOCAT} - unix-connect:$socket_name
|
@ -10,6 +10,7 @@
|
|||||||
, gtk3
|
, gtk3
|
||||||
, gtk-layer-shell
|
, gtk-layer-shell
|
||||||
, lua5_3
|
, lua5_3
|
||||||
|
, socat
|
||||||
} :
|
} :
|
||||||
let
|
let
|
||||||
lua = lua5_3;
|
lua = lua5_3;
|
||||||
@ -63,5 +64,12 @@ stdenv.mkDerivation {
|
|||||||
webkitgtk
|
webkitgtk
|
||||||
];
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
substitute bin/eufon.sh $out/bin/eufon \
|
||||||
|
--replace SOCAT=socat SOCAT=${socat}/bin/socat
|
||||||
|
chmod +x $out/bin/eufon
|
||||||
|
'';
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
}
|
}
|
||||||
|
@ -125,32 +125,51 @@ cursor_touch_down_notify(struct wl_listener *listener, void *data)
|
|||||||
{
|
{
|
||||||
struct kiwmi_cursor *cursor =
|
struct kiwmi_cursor *cursor =
|
||||||
wl_container_of(listener, cursor, cursor_touch_down);
|
wl_container_of(listener, cursor, cursor_touch_down);
|
||||||
struct kiwmi_server *server = cursor->server;
|
struct kiwmi_server *server = cursor->server;
|
||||||
|
struct kiwmi_desktop *desktop = &server->desktop;
|
||||||
struct wlr_event_touch_down *event = data;
|
struct wlr_event_touch_down *event = data;
|
||||||
|
|
||||||
struct kiwmi_input *input = &server->input;
|
struct kiwmi_input *input = &server->input;
|
||||||
struct wlr_seat *seat = input->seat->seat;
|
struct wlr_seat *seat = input->seat->seat;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
|
||||||
/* FIXME x,y are in the wrong co-ordinate system */
|
/* FIXME figure out what scaling should be done here.
|
||||||
|
* Does the touch co-ordinate system map onto a single output
|
||||||
|
* (e.g. phone screen) or onto the entire layout (tablet,
|
||||||
|
* maybe?)
|
||||||
|
*/
|
||||||
|
double lx = 720 * event->x;
|
||||||
|
double ly = 1440 * event->y;
|
||||||
|
double sx, sy;
|
||||||
|
|
||||||
|
struct kiwmi_view *view = view_at(
|
||||||
|
desktop,
|
||||||
|
lx, ly,
|
||||||
|
&surface,
|
||||||
|
&sx, &sy);
|
||||||
|
|
||||||
|
wlr_log(WLR_DEBUG, "view %x surface %x %f,%f %f,%f\n",
|
||||||
|
view, surface, lx, ly, sx, sy);
|
||||||
|
|
||||||
|
/* we send the event to lua with 0..1 co-ordinates, because
|
||||||
|
* it may not be over any surface
|
||||||
|
*/
|
||||||
struct kiwmi_cursor_touch_event new_event = {
|
struct kiwmi_cursor_touch_event new_event = {
|
||||||
.event = "down",
|
.event = "down",
|
||||||
.id = event->touch_id,
|
.id = event->touch_id,
|
||||||
.x = event->x,
|
.x = event->x,
|
||||||
.y = event->y,
|
.y = event->y,
|
||||||
};
|
};
|
||||||
struct wlr_surface *surface = NULL;
|
|
||||||
|
|
||||||
wl_signal_emit(&cursor->events.touch, &new_event);
|
wl_signal_emit(&cursor->events.touch, &new_event);
|
||||||
|
|
||||||
/*
|
if(!new_event.handled &&
|
||||||
FIXME when we figure out the co-ordinates then find view
|
surface &&
|
||||||
at this xy and pass the event on if it wants it
|
|
||||||
*/
|
|
||||||
if(false &&
|
|
||||||
!new_event.handled &&
|
|
||||||
wlr_surface_accepts_touch(seat, surface)) {
|
wlr_surface_accepts_touch(seat, surface)) {
|
||||||
|
wlr_log(WLR_DEBUG, "surface %x %f %f\n",
|
||||||
|
surface, sx, sy);
|
||||||
wlr_seat_touch_notify_down(seat, surface, event->time_msec,
|
wlr_seat_touch_notify_down(seat, surface, event->time_msec,
|
||||||
event->touch_id, event->x, event->y);
|
event->touch_id, sx, sy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,16 +183,13 @@ cursor_touch_up_notify(struct wl_listener *listener, void *data)
|
|||||||
struct kiwmi_input *input = &server->input;
|
struct kiwmi_input *input = &server->input;
|
||||||
struct wlr_seat *seat = input->seat->seat;
|
struct wlr_seat *seat = input->seat->seat;
|
||||||
|
|
||||||
/* FIXME x,y are in the wrong co-ordinate system */
|
|
||||||
struct kiwmi_cursor_touch_event new_event = {
|
struct kiwmi_cursor_touch_event new_event = {
|
||||||
.event = "up",
|
.event = "up",
|
||||||
.id = event->touch_id,
|
.id = event->touch_id,
|
||||||
};
|
};
|
||||||
struct wlr_surface *surface = NULL;
|
|
||||||
wl_signal_emit(&cursor->events.touch, &new_event);
|
wl_signal_emit(&cursor->events.touch, &new_event);
|
||||||
if(false &&
|
if(!new_event.handled) {
|
||||||
!new_event.handled &&
|
|
||||||
wlr_surface_accepts_touch(seat, surface)) {
|
|
||||||
wlr_seat_touch_notify_up(seat, event->time_msec, event->touch_id);
|
wlr_seat_touch_notify_up(seat, event->time_msec, event->touch_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,19 +204,20 @@ cursor_touch_motion_notify(struct wl_listener *listener, void *data)
|
|||||||
struct kiwmi_input *input = &server->input;
|
struct kiwmi_input *input = &server->input;
|
||||||
struct wlr_seat *seat = input->seat->seat;
|
struct wlr_seat *seat = input->seat->seat;
|
||||||
|
|
||||||
/* FIXME x,y are in the wrong co-ordinate system */
|
|
||||||
struct kiwmi_cursor_touch_event new_event = {
|
struct kiwmi_cursor_touch_event new_event = {
|
||||||
.event = "motion",
|
.event = "motion",
|
||||||
.id = event->touch_id,
|
.id = event->touch_id,
|
||||||
.x = event->x,
|
.x = event->x,
|
||||||
.y = event->y,
|
.y = event->y,
|
||||||
};
|
};
|
||||||
struct wlr_surface *surface = NULL;
|
|
||||||
wl_signal_emit(&cursor->events.touch, &new_event);
|
wl_signal_emit(&cursor->events.touch, &new_event);
|
||||||
|
|
||||||
if(false &&
|
|
||||||
!new_event.handled &&
|
if(!new_event.handled) {
|
||||||
wlr_surface_accepts_touch(seat, surface)) {
|
/* UNSURE: should we still send this even if the touch_down
|
||||||
|
* didn't get sent because the surface doesn't accept
|
||||||
|
* touch? */
|
||||||
wlr_seat_touch_notify_motion(seat, event->time_msec,
|
wlr_seat_touch_notify_motion(seat, event->time_msec,
|
||||||
event->touch_id, event->x, event->y);
|
event->touch_id, event->x, event->y);
|
||||||
}
|
}
|
||||||
@ -216,21 +233,13 @@ cursor_touch_frame_notify(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
struct wlr_seat *seat = input->seat->seat;
|
struct wlr_seat *seat = input->seat->seat;
|
||||||
|
|
||||||
/* FIXME x,y are in the wrong co-ordinate system */
|
|
||||||
struct kiwmi_cursor_touch_event new_event = {
|
struct kiwmi_cursor_touch_event new_event = {
|
||||||
.event = "frame",
|
.event = "frame",
|
||||||
};
|
};
|
||||||
struct wlr_surface *surface = NULL;
|
|
||||||
|
|
||||||
wl_signal_emit(&cursor->events.touch, &new_event);
|
wl_signal_emit(&cursor->events.touch, &new_event);
|
||||||
|
|
||||||
/*
|
if(!new_event.handled) {
|
||||||
FIXME when we figure out the co-ordinates then find view
|
|
||||||
at this xy and pass the event on if it wants it
|
|
||||||
*/
|
|
||||||
if(false &&
|
|
||||||
!new_event.handled &&
|
|
||||||
wlr_surface_accepts_touch(seat, surface)) {
|
|
||||||
wlr_seat_touch_notify_frame(seat);
|
wlr_seat_touch_notify_frame(seat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,12 @@ new_pointer(struct kiwmi_input *input, struct wlr_input_device *device)
|
|||||||
wlr_cursor_attach_input_device(input->cursor->cursor, device);
|
wlr_cursor_attach_input_device(input->cursor->cursor, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
new_touch(struct kiwmi_input *input, struct wlr_input_device *device)
|
||||||
|
{
|
||||||
|
wlr_cursor_attach_input_device(input->cursor->cursor, device);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_keyboard(struct kiwmi_input *input, struct wlr_input_device *device)
|
new_keyboard(struct kiwmi_input *input, struct wlr_input_device *device)
|
||||||
{
|
{
|
||||||
@ -53,6 +59,9 @@ new_input_notify(struct wl_listener *listener, void *data)
|
|||||||
case WLR_INPUT_DEVICE_POINTER:
|
case WLR_INPUT_DEVICE_POINTER:
|
||||||
new_pointer(input, device);
|
new_pointer(input, device);
|
||||||
break;
|
break;
|
||||||
|
case WLR_INPUT_DEVICE_TOUCH:
|
||||||
|
new_touch(input, device);
|
||||||
|
break;
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:
|
||||||
new_keyboard(input, device);
|
new_keyboard(input, device);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user