mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Wayland server: remove attach calls from server, surface attach is delegated to cairo surface
This commit is contained in:
parent
91a1479193
commit
96f07c13f7
4 changed files with 30 additions and 17 deletions
|
@ -37,7 +37,8 @@
|
|||
#include <cairo/cairo.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
#include "cairo/WaylandCairoSurface.h"
|
||||
#include "cairo/CairoSurface.h"
|
||||
|
||||
#include "wayland/xdg-shell-client-protocol.h"
|
||||
#include "wayland/wlr-layer-shell-client-protocol.h"
|
||||
|
||||
|
@ -138,7 +139,7 @@ struct window
|
|||
struct xdg_positioner *positioner;
|
||||
struct zwlr_layer_surface_v1 *layer_surface;
|
||||
struct output *output;
|
||||
WaylandCairoSurface *wcs;
|
||||
CairoSurface *wcs;
|
||||
};
|
||||
|
||||
@interface WaylandServer : GSDisplayServer
|
||||
|
|
6
Source/wayland/WaylandServer+Layershell.m
Normal file → Executable file
6
Source/wayland/WaylandServer+Layershell.m
Normal file → Executable file
|
@ -40,9 +40,9 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
|
|||
window->configured = YES;
|
||||
if (window->buffer_needs_attach)
|
||||
{
|
||||
NSDebugLog(@"attach: win=%d layer", window->window_id);
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
wl_surface_commit(window->surface);
|
||||
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
|
||||
window->width, window->height
|
||||
):window->window_id];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
9
Source/wayland/WaylandServer+Xdgshell.m
Executable file → Normal file
9
Source/wayland/WaylandServer+Xdgshell.m
Executable file → Normal file
|
@ -56,9 +56,9 @@ xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
|
|||
|
||||
if (window->buffer_needs_attach)
|
||||
{
|
||||
NSDebugLog(@"attach: win=%d toplevel", window->window_id);
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
wl_surface_commit(window->surface);
|
||||
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
|
||||
window->width, window->height
|
||||
):window->window_id];
|
||||
}
|
||||
|
||||
if (wlconfig->pointer.focus
|
||||
|
@ -129,7 +129,8 @@ xdg_popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x,
|
|||
struct window *window = data;
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
|
||||
NSDebugLog(@"xdg_popup_configure");
|
||||
NSDebugLog(@"[%d] xdg_popup_configure [%d,%d %dx%d]", window->window_id, x, y,
|
||||
width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -487,6 +487,8 @@ WaylandServer (WindowOps)
|
|||
if (window->toplevel)
|
||||
{
|
||||
xdg_toplevel_set_title(window->toplevel, cString);
|
||||
wl_surface_commit(window->surface);
|
||||
wl_display_flush(window->wlconfig->display);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,7 +513,11 @@ WaylandServer (WindowOps)
|
|||
struct window *window;
|
||||
|
||||
window = get_window_with_id(wlconfig, winId);
|
||||
|
||||
// FIXME we could resize the current surface instead of creating a new one
|
||||
if (window->wcs)
|
||||
{
|
||||
NSDebugLog(@"[%d] window has already a surface", winId);
|
||||
}
|
||||
GSSetDevice(ctxt, window, 0.0, window->height);
|
||||
DPSinitmatrix(ctxt);
|
||||
DPSinitclip(ctxt);
|
||||
|
@ -970,7 +976,6 @@ WaylandServer (SurfaceRoles)
|
|||
}
|
||||
if (!parentwindow)
|
||||
{
|
||||
//[self createTopLevel: window];
|
||||
return;
|
||||
}
|
||||
NSDebugLog(@"new popup: %d parent id: %d", win, parentwindow->window_id);
|
||||
|
@ -991,7 +996,7 @@ WaylandServer (SurfaceRoles)
|
|||
{
|
||||
NSDebugLog(@"createPopupShell");
|
||||
|
||||
if (parent->xdg_surface == NULL || parent->toplevel == NULL)
|
||||
if (parent->toplevel == NULL && parent->layer_surface == NULL)
|
||||
{
|
||||
NSDebugLog(@"parent surface %d is not toplevel", parent->window_id);
|
||||
return;
|
||||
|
@ -1025,12 +1030,14 @@ WaylandServer (SurfaceRoles)
|
|||
xdg_positioner_set_offset(positioner, (child->pos_x - parent->pos_x),
|
||||
(child->pos_y - parent->pos_y));
|
||||
|
||||
// NSDebugLog(@"xdg_positioner offset: %f,%f",
|
||||
// (child->pos_x - parent->pos_x), (child->pos_y - parent->pos_y));
|
||||
|
||||
child->popup = xdg_surface_get_popup(child->xdg_surface, parent->xdg_surface,
|
||||
positioner);
|
||||
|
||||
if (parent->layer_surface)
|
||||
{
|
||||
zwlr_layer_surface_v1_get_popup(parent->layer_surface, child->popup);
|
||||
}
|
||||
|
||||
xdg_popup_add_listener(child->popup, &xdg_popup_listener, child);
|
||||
xdg_surface_add_listener(child->xdg_surface, &xdg_surface_listener, child);
|
||||
|
||||
|
@ -1040,8 +1047,8 @@ WaylandServer (SurfaceRoles)
|
|||
NSDebugLog(@"child_geometry : %f,%f %fx%f", child->pos_x - parent->pos_x,
|
||||
child->pos_y - parent->pos_y, child->width, child->height);
|
||||
wl_surface_commit(child->surface);
|
||||
wl_display_dispatch_pending(wlconfig->display);
|
||||
wl_display_flush(wlconfig->display);
|
||||
wl_display_roundtrip(wlconfig->display);
|
||||
xdg_positioner_destroy(positioner);
|
||||
}
|
||||
|
||||
- (void)destroySurfaceRole:(struct window *)window
|
||||
|
@ -1072,6 +1079,10 @@ WaylandServer (SurfaceRoles)
|
|||
xdg_surface_destroy(window->xdg_surface);
|
||||
window->xdg_surface = NULL;
|
||||
}
|
||||
if (window->wcs)
|
||||
{
|
||||
[window->wcs destroySurface];
|
||||
}
|
||||
window->configured = NO;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue