Fix build errors with Wayland on Debian 13 (trixie) using Clang 16 (#48)

* Solve an undelcared close function

* Fix xdgshell protocol handling and resolve compile errors

* Fixing build errors in WaylandServer+Cursor

* Revert changes except wl_cursor_destroy to fix build and avoid regressions

* Fix selector warnings and method call type issues

* Use window parameter directly

* Comments removed

* Include NSGraphics to eliminate redundant declaration.

* Remove NSWindow include that was replaced by NSGraphics
This commit is contained in:
Joe Maloney 2024-08-28 16:03:03 -05:00 committed by GitHub
parent e03ddf7b2b
commit d27af6af10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 40 deletions

View file

@ -38,6 +38,8 @@
#include <linux/input.h>
#include "wayland-cursor.h"
extern void wl_cursor_destroy(struct wl_cursor *cursor);
// XXX should this be configurable by the user?
#define DOUBLECLICK_DELAY 300
#define DOUBLECLICK_MOVE_THREASHOLD 3
@ -852,4 +854,4 @@ WaylandServer (Cursor)
wlconfig->mouse_scroll_multiplier = 1.0f;
}
}
@end
@end

View file

@ -31,6 +31,7 @@
#include <linux/input.h>
#include <AppKit/NSText.h>
#include <sys/mman.h>
#include <unistd.h>
static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,

View file

@ -28,10 +28,11 @@
#include "wayland/WaylandServer.h"
#include <AppKit/NSEvent.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSGraphics.h>
static void
xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
uint32_t serial)
uint32_t serial)
{
struct window *window = data;
@ -43,7 +44,6 @@ xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
free(window);
return;
}
WaylandConfig *wlconfig = window->wlconfig;
NSEvent *ev = nil;
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
@ -57,22 +57,22 @@ xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
if (window->buffer_needs_attach)
{
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
window->width, window->height
):window->window_id];
window->width, window->height)
:window->window_id];
}
if (wlconfig->pointer.focus
&& wlconfig->pointer.focus->window_id == window->window_id)
if (window->wlconfig->pointer.focus
&& window->wlconfig->pointer.focus->window_id == window->window_id)
{
ev = [NSEvent otherEventWithType:NSAppKitDefined
location:NSZeroPoint
modifierFlags:0
timestamp:0
windowNumber:(int) window->window_id
context:GSCurrentContext()
subtype:GSAppKitWindowFocusIn
data1:0
data2:0];
location:NSZeroPoint
modifierFlags:0
timestamp:0
windowNumber:(int) window->window_id
context:GSCurrentContext()
subtype:GSAppKitWindowFocusIn
data1:0
data2:0];
[nswindow sendEvent:ev];
}
@ -80,15 +80,14 @@ xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
static void
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;
WaylandConfig *wlconfig = window->wlconfig;
NSDebugLog(@"[%d] xdg_toplevel_configure %ldx%ld", window->window_id, width,
height);
NSDebugLog(@"[%d] xdg_toplevel_configure %dx%d", window->window_id, width,
height);
// the compositor can send 0.0x0.0
// The compositor can send 0x0
if (width == 0 || height == 0)
{
return;
@ -99,45 +98,43 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
window->height = height;
xdg_surface_set_window_geometry(window->xdg_surface, 0, 0, window->width,
window->height);
window->height);
NSEvent *ev = [NSEvent otherEventWithType:NSAppKitDefined
location:NSMakePoint(0.0, 0.0)
modifierFlags:0
timestamp:0
windowNumber:window->window_id
context:GSCurrentContext()
subtype:GSAppKitWindowResized
data1:window->width
data2:window->height];
location:NSMakePoint(0.0, 0.0)
modifierFlags:0
timestamp:0
windowNumber:window->window_id
context:GSCurrentContext()
subtype:GSAppKitWindowResized
data1:window->width
data2:window->height];
[(GSWindowWithNumber(window->window_id)) sendEvent:ev];
}
NSDebugLog(@"[%d] notify resize from backend=%ldx%ld", window->window_id,
width, height);
NSDebugLog(@"[%d] notify resize from backend=%dx%d", window->window_id,
width, height);
}
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");
}
static void
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;
WaylandConfig *wlconfig = window->wlconfig;
NSDebugLog(@"[%d] xdg_popup_configure [%d,%d %dx%d]", window->window_id, x, y,
width, height);
width, height);
}
static void
xdg_popup_done(void *data, struct xdg_popup *xdg_popup)
{
struct window *window = data;
WaylandConfig *wlconfig = window->wlconfig;
window->terminated = YES;
xdg_popup_destroy(xdg_popup);
wl_surface_destroy(window->surface);
@ -145,7 +142,7 @@ xdg_popup_done(void *data, struct xdg_popup *xdg_popup)
static void
wm_base_handle_ping(void *data, struct xdg_wm_base *xdg_wm_base,
uint32_t serial)
uint32_t serial)
{
NSDebugLog(@"wm_base_handle_ping");
xdg_wm_base_pong(xdg_wm_base, serial);
@ -167,4 +164,4 @@ const struct xdg_popup_listener xdg_popup_listener = {
const struct xdg_toplevel_listener xdg_toplevel_listener = {
.configure = xdg_toplevel_configure,
.close = xdg_toplevel_close_handler,
};
};

View file

@ -781,7 +781,7 @@ WaylandServer (SurfaceRoles)
break;
case NSPopUpMenuWindowLevel:
NSDebugLog(@"[%d] NSPopUpMenuWindowLevel", win);
[self createPopup:win];
[self createPopup:window];
break;
case NSScreenSaverWindowLevel:
NSDebugLog(@"[%d] NSScreenSaverWindowLevel", win);
@ -1099,4 +1099,4 @@ WaylandServer (SurfaceRoles)
wl_display_flush(window->wlconfig->display);
}
@end
@end