mirror of
https://github.com/gnustep/libs-back.git
synced 2025-06-01 09:42:17 +00:00
Fix xdgshell protocol handling and resolve compile errors
This commit is contained in:
parent
4da87c840f
commit
d08ee51ca4
1 changed files with 37 additions and 37 deletions
|
@ -28,6 +28,10 @@
|
||||||
#include "wayland/WaylandServer.h"
|
#include "wayland/WaylandServer.h"
|
||||||
#include <AppKit/NSEvent.h>
|
#include <AppKit/NSEvent.h>
|
||||||
#include <AppKit/NSApplication.h>
|
#include <AppKit/NSApplication.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
|
|
||||||
|
// Ensure the function GSWindowWithNumber is declared or included from the appropriate header
|
||||||
|
NSWindow *GSWindowWithNumber(int window_id);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
|
xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
|
||||||
|
@ -43,7 +47,6 @@ xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
|
||||||
free(window);
|
free(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WaylandConfig *wlconfig = window->wlconfig;
|
|
||||||
|
|
||||||
NSEvent *ev = nil;
|
NSEvent *ev = nil;
|
||||||
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
|
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
|
||||||
|
@ -57,12 +60,12 @@ xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
|
||||||
if (window->buffer_needs_attach)
|
if (window->buffer_needs_attach)
|
||||||
{
|
{
|
||||||
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
|
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
|
||||||
window->width, window->height
|
window->width, window->height)
|
||||||
):window->window_id];
|
:window->window_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlconfig->pointer.focus
|
if (window->wlconfig->pointer.focus
|
||||||
&& wlconfig->pointer.focus->window_id == window->window_id)
|
&& window->wlconfig->pointer.focus->window_id == window->window_id)
|
||||||
{
|
{
|
||||||
ev = [NSEvent otherEventWithType:NSAppKitDefined
|
ev = [NSEvent otherEventWithType:NSAppKitDefined
|
||||||
location:NSZeroPoint
|
location:NSZeroPoint
|
||||||
|
@ -83,12 +86,11 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
|
||||||
int32_t width, int32_t height, struct wl_array *states)
|
int32_t width, int32_t height, struct wl_array *states)
|
||||||
{
|
{
|
||||||
struct window *window = data;
|
struct window *window = data;
|
||||||
WaylandConfig *wlconfig = window->wlconfig;
|
|
||||||
|
|
||||||
NSDebugLog(@"[%d] xdg_toplevel_configure %ldx%ld", window->window_id, width,
|
NSDebugLog(@"[%d] xdg_toplevel_configure %dx%d", window->window_id, width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
// the compositor can send 0.0x0.0
|
// The compositor can send 0x0
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -112,12 +114,12 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
|
||||||
data2:window->height];
|
data2:window->height];
|
||||||
[(GSWindowWithNumber(window->window_id)) sendEvent:ev];
|
[(GSWindowWithNumber(window->window_id)) sendEvent:ev];
|
||||||
}
|
}
|
||||||
NSDebugLog(@"[%d] notify resize from backend=%ldx%ld", window->window_id,
|
NSDebugLog(@"[%d] notify resize from backend=%dx%d", window->window_id,
|
||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_close_handler(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
|
xdg_toplevel_close_handler(void *data, struct xdg_toplevel *xdg_toplevel)
|
||||||
{
|
{
|
||||||
NSDebugLog(@"xdg_toplevel_close_handler");
|
NSDebugLog(@"xdg_toplevel_close_handler");
|
||||||
}
|
}
|
||||||
|
@ -127,7 +129,6 @@ xdg_popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x,
|
||||||
int32_t y, int32_t width, int32_t height)
|
int32_t y, int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
struct window *window = data;
|
struct window *window = data;
|
||||||
WaylandConfig *wlconfig = window->wlconfig;
|
|
||||||
|
|
||||||
NSDebugLog(@"[%d] xdg_popup_configure [%d,%d %dx%d]", window->window_id, x, y,
|
NSDebugLog(@"[%d] xdg_popup_configure [%d,%d %dx%d]", window->window_id, x, y,
|
||||||
width, height);
|
width, height);
|
||||||
|
@ -137,7 +138,6 @@ static void
|
||||||
xdg_popup_done(void *data, struct xdg_popup *xdg_popup)
|
xdg_popup_done(void *data, struct xdg_popup *xdg_popup)
|
||||||
{
|
{
|
||||||
struct window *window = data;
|
struct window *window = data;
|
||||||
WaylandConfig *wlconfig = window->wlconfig;
|
|
||||||
window->terminated = YES;
|
window->terminated = YES;
|
||||||
xdg_popup_destroy(xdg_popup);
|
xdg_popup_destroy(xdg_popup);
|
||||||
wl_surface_destroy(window->surface);
|
wl_surface_destroy(window->surface);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue