wayland: whatever it works on kde
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
8a59ee840b
commit
daced7a897
4 changed files with 51 additions and 27 deletions
|
|
@ -437,6 +437,7 @@ struct _MwLLWayland {
|
||||||
enum _MwLLWaylandType type_to_be;
|
enum _MwLLWaylandType type_to_be;
|
||||||
|
|
||||||
MwRect clipping_rect;
|
MwRect clipping_rect;
|
||||||
|
MwBool no;
|
||||||
|
|
||||||
MwBool detatching;
|
MwBool detatching;
|
||||||
MwPoint detach_point;
|
MwPoint detach_point;
|
||||||
|
|
|
||||||
|
|
@ -400,12 +400,12 @@ static void pointer_enter(void* data, struct wl_pointer* wl_pointer, MwU32 seria
|
||||||
WAYLAND_EVENT_OP_START(self);
|
WAYLAND_EVENT_OP_START(self);
|
||||||
while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent;
|
while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent;
|
||||||
|
|
||||||
curSurface = surface;
|
if(self->wayland.framebuffer.surface == surface) {
|
||||||
|
curSurface = surface;
|
||||||
self->wayland.pointer_serial = serial;
|
self->wayland.pointer_serial = serial;
|
||||||
|
|
||||||
wl_pointer_set_cursor(self->wayland.pointer, self->wayland.pointer_serial, topmost_parent->wayland.cursor.surface, 0, 0);
|
|
||||||
|
|
||||||
|
wl_pointer_set_cursor(self->wayland.pointer, self->wayland.pointer_serial, topmost_parent->wayland.cursor.surface, 0, 0);
|
||||||
|
}
|
||||||
WAYLAND_EVENT_OP_END(self);
|
WAYLAND_EVENT_OP_END(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -506,14 +506,6 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
|
||||||
|
|
||||||
currentlyHeldWidget = topmost_parent->wayland.currentlyHeldWidget;
|
currentlyHeldWidget = topmost_parent->wayland.currentlyHeldWidget;
|
||||||
|
|
||||||
if(currentlyHeldWidget) {
|
|
||||||
currentlyHeldWidget->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x);
|
|
||||||
currentlyHeldWidget->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y);
|
|
||||||
p.point = currentlyHeldWidget->wayland.cur_mouse_pos;
|
|
||||||
MwLLDispatch(currentlyHeldWidget, move, &p);
|
|
||||||
h = MwTRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(self->wayland.framebuffer.surface) {
|
if(self->wayland.framebuffer.surface) {
|
||||||
inArea |= self->wayland.framebuffer.surface == curSurface;
|
inArea |= self->wayland.framebuffer.surface == curSurface;
|
||||||
}
|
}
|
||||||
|
|
@ -521,15 +513,23 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
|
||||||
if(self->wayland.backbuffer.surface) {
|
if(self->wayland.backbuffer.surface) {
|
||||||
inArea |= self->wayland.backbuffer.surface == curSurface;
|
inArea |= self->wayland.backbuffer.surface == curSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(currentlyHeldWidget) {
|
||||||
|
currentlyHeldWidget->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x);
|
||||||
|
currentlyHeldWidget->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y);
|
||||||
|
p.point = currentlyHeldWidget->wayland.cur_mouse_pos;
|
||||||
|
MwLLDispatch(currentlyHeldWidget, down, &p);
|
||||||
|
h = MwTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if(inArea) {
|
if(inArea) {
|
||||||
if(h) {
|
self->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x);
|
||||||
self->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x);
|
self->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y);
|
||||||
self->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y);
|
p.point = self->wayland.cur_mouse_pos;
|
||||||
p.point = self->wayland.cur_mouse_pos;
|
MwLLDispatch(self, move, &p);
|
||||||
MwLLDispatch(self, move, &p);
|
|
||||||
}
|
|
||||||
wl_pointer_set_cursor(self->wayland.pointer, self->wayland.pointer_serial, self->wayland.cursor.surface, 0, 0);
|
wl_pointer_set_cursor(self->wayland.pointer, self->wayland.pointer_serial, self->wayland.cursor.surface, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WAYLAND_EVENT_OP_END(self);
|
WAYLAND_EVENT_OP_END(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -998,7 +998,7 @@ static wayland_protocol_t* xdg_wm_base_setup(MwU32 name, struct _MwLLWayland* wa
|
||||||
|
|
||||||
((struct xdg_wm_base_listener*)proto->listener)->ping = xdg_wm_base_ping;
|
((struct xdg_wm_base_listener*)proto->listener)->ping = xdg_wm_base_ping;
|
||||||
|
|
||||||
proto->context = wl_registry_bind(wayland->registry, name, &xdg_wm_base_interface, 1);
|
proto->context = wl_registry_bind(wayland->registry, name, &xdg_wm_base_interface, 3);
|
||||||
xdg_wm_base_add_listener(proto->context, proto->listener, wayland);
|
xdg_wm_base_add_listener(proto->context, proto->listener, wayland);
|
||||||
|
|
||||||
return proto;
|
return proto;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ void MwLLWaylandRegionSetup(MwLL handle) {
|
||||||
} else {
|
} else {
|
||||||
wl_region_subtract(handle->wayland.region, 0, 0, width + abs(handle->wayland.x), height + abs(handle->wayland.y));
|
wl_region_subtract(handle->wayland.region, 0, 0, width + abs(handle->wayland.x), height + abs(handle->wayland.y));
|
||||||
wl_region_add(handle->wayland.region, handle->wayland.clipping_rect.x, handle->wayland.clipping_rect.y, handle->wayland.clipping_rect.width, handle->wayland.clipping_rect.height);
|
wl_region_add(handle->wayland.region, handle->wayland.clipping_rect.x, handle->wayland.clipping_rect.y, handle->wayland.clipping_rect.width, handle->wayland.clipping_rect.height);
|
||||||
|
|
||||||
if(!handle->wayland.parent)
|
if(!handle->wayland.parent)
|
||||||
wl_region_add(handle->wayland.region, 0, 0, width, height);
|
wl_region_add(handle->wayland.region, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,10 +225,12 @@ static void xdg_surface_configure(
|
||||||
|
|
||||||
void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer) {
|
void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer) {
|
||||||
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
|
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
|
||||||
// Yes this is needed every time, it's how we fix weston.
|
if(buffer->surface) {
|
||||||
if(self->wayland.configured)
|
// Yes this is needed every time, it's how we fix weston.
|
||||||
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
|
if(self->wayland.configured)
|
||||||
wl_surface_commit(buffer->surface);
|
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
|
||||||
|
wl_surface_commit(buffer->surface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toplevel setup function */
|
/* Toplevel setup function */
|
||||||
|
|
@ -418,9 +420,19 @@ static void popup_done(void* data,
|
||||||
(void)xdg_popup;
|
(void)xdg_popup;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void popup_repositioned(void* data,
|
||||||
|
struct xdg_popup* xdg_popup,
|
||||||
|
uint32_t token) {
|
||||||
|
MwLL self = data;
|
||||||
|
|
||||||
|
xdg_surface_ack_configure(self->wayland.popup->xdg_surface, token);
|
||||||
|
};
|
||||||
|
|
||||||
struct xdg_popup_listener popup_listener = {
|
struct xdg_popup_listener popup_listener = {
|
||||||
.configure = popup_configure,
|
.configure = popup_configure,
|
||||||
.popup_done = popup_done,
|
.popup_done = popup_done,
|
||||||
|
.repositioned = popup_repositioned,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Popup setup function */
|
/* Popup setup function */
|
||||||
|
|
@ -483,6 +495,8 @@ static void setup_popup(MwLL r, int x, int y, MwLL parent) {
|
||||||
xdg_surface,
|
xdg_surface,
|
||||||
r->wayland.popup->xdg_positioner);
|
r->wayland.popup->xdg_positioner);
|
||||||
|
|
||||||
|
uint32_t ver = wl_proxy_get_version((struct wl_proxy*)r->wayland.popup->xdg_popup);
|
||||||
|
|
||||||
xdg_popup_add_listener(r->wayland.popup->xdg_popup, &popup_listener, r);
|
xdg_popup_add_listener(r->wayland.popup->xdg_popup, &popup_listener, r);
|
||||||
|
|
||||||
r->wayland.popup->xdg_surface_listener.configure = xdg_surface_configure;
|
r->wayland.popup->xdg_surface_listener.configure = xdg_surface_configure;
|
||||||
|
|
@ -797,9 +811,16 @@ static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
||||||
if(handle->wayland.type == MwLL_WAYLAND_SUBLEVEL) {
|
if(handle->wayland.type == MwLL_WAYLAND_SUBLEVEL) {
|
||||||
wl_subsurface_set_position(handle->wayland.sublevel->subsurface, x, y);
|
wl_subsurface_set_position(handle->wayland.sublevel->subsurface, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(handle->wayland.type == MwLL_WAYLAND_POPUP) {
|
||||||
|
xdg_positioner_set_anchor_rect(handle->wayland.popup->xdg_positioner, handle->wayland.parent->wayland.x, handle->wayland.parent->wayland.y, handle->wayland.ww, handle->wayland.wh);
|
||||||
|
xdg_positioner_set_offset(handle->wayland.popup->xdg_positioner, x, y);
|
||||||
|
xdg_popup_reposition(handle->wayland.popup->xdg_popup, handle->wayland.popup->xdg_positioner, 0);
|
||||||
|
xdg_surface_set_window_geometry(handle->wayland.popup->xdg_surface, 0, 0, handle->wayland.ww, handle->wayland.wh);
|
||||||
|
}
|
||||||
MwLLWaylandRegionSetup(handle);
|
MwLLWaylandRegionSetup(handle);
|
||||||
|
|
||||||
if(handle->wayland.type == MwLL_WAYLAND_SUBLEVEL) recursive_render(handle);
|
if(handle->wayland.type != MwLL_WAYLAND_TOPLEVEL) recursive_render(handle);
|
||||||
|
|
||||||
MwLLDispatch(handle, draw, NULL);
|
MwLLDispatch(handle, draw, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -1469,6 +1490,7 @@ static void MwLLMakeToolWindowImpl(MwLL handle) {
|
||||||
|
|
||||||
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
|
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
|
||||||
MwLL topmost_parent = handle;
|
MwLL topmost_parent = handle;
|
||||||
|
|
||||||
WIDGET_CHECK(handle);
|
WIDGET_CHECK(handle);
|
||||||
while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent;
|
while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue