Skip to content

Commit 9923085

Browse files
deploy: a4004dd
1 parent 0adbdb0 commit 9923085

File tree

31 files changed

+12256
-12231
lines changed

31 files changed

+12256
-12231
lines changed

Makefile

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ else
9999
endif
100100

101101
ifeq ($(WAYLAND),1)
102+
WAYLAND_SOURCE = $(shell make -f wayland.mk sources -s)
103+
102104
NO_VULKAN = 1
103105
NO_GLES = 0
104106
NO_EGL = 0
105-
LIBS += -D RGFW_WAYLAND relative-pointer-unstable-v1.c pointer-constraints-unstable-v1.c xdg-toplevel-icon-v1.c xdg-output-unstable-v1.c xdg-decoration-unstable-v1.c xdg-shell.c -lwayland-cursor -lwayland-client -lxkbcommon -lwayland-egl -lEGL -lm
107+
LIBS += -D RGFW_WAYLAND $(WAYLAND_SOURCE) -lwayland-cursor -lwayland-client -lxkbcommon -lwayland-egl -lEGL -lm
106108
LINK_GL1 = -lEGL -lGL
107109

108110
# LIBS += -ldecor-0
@@ -191,37 +193,37 @@ TEST_OUTPUTS = \
191193
tests/loop \
192194

193195

194-
all: xdg-shell.c $(EXAMPLE_OUTPUTS) $(EXAMPLE_OUTPUTS_CUSTOM) libRGFW$(LIB_EXT) libRGFW.a
196+
all: $(WAYLAND_SOURCE) $(EXAMPLE_OUTPUTS) $(EXAMPLE_OUTPUTS_CUSTOM) libRGFW$(LIB_EXT) libRGFW.a
195197

196-
examples: xdg-shell.c $(EXAMPLE_OUTPUTS) $(EXAMPLE_OUTPUTS_CUSTOM)
198+
examples: $(WAYLAND_SOURCE) $(EXAMPLE_OUTPUTS) $(EXAMPLE_OUTPUTS_CUSTOM)
197199

198-
tests: xdg-shell.c $(TEST_OUTPUTS)
200+
tests: $(WAYLAND_SOURCE) $(TEST_OUTPUTS)
199201

200-
examples/gears/gears: examples/gears/gears.c RGFW.h xdg-shell.c
202+
examples/gears/gears: examples/gears/gears.c RGFW.h $(WAYLAND_SOURCE)
201203
ifneq (,$(filter $(CC),emcc em++))
202204
@echo gears is not supported on this platform
203205
else
204206
$(CC) $(CFLAGS) -I. $< $(LINK_GL1) $(LIBS) -lm $($) -o $@$(EXT)
205207
endif
206208

207-
examples/srgb/srgb: examples/srgb/srgb.c RGFW.h xdg-shell.c
209+
examples/srgb/srgb: examples/srgb/srgb.c RGFW.h $(WAYLAND_SOURCE)
208210
$(CC) $(CFLAGS) -I. $< $(LINK_GL1) $(LIBS) -lm $($) -o $@$(EXT)
209211

210-
examples/portableGL/pgl: examples/portableGL/pgl.c RGFW.h xdg-shell.c
212+
examples/portableGL/pgl: examples/portableGL/pgl.c RGFW.h $(WAYLAND_SOURCE)
211213
ifeq (,$(filter $(CC),emcc em++))
212214
$(CC) -w $(CFLAGS) -I. $< -lm $(LIBS) -o $@
213215
else
214216
@echo "the portableGL example doesn't support html5"
215217
endif
216218

217-
examples/gles2/gles2: examples/gles2/gles2.c RGFW.h xdg-shell.c
219+
examples/gles2/gles2: examples/gles2/gles2.c RGFW.h $(WAYLAND_SOURCE)
218220
ifneq ($(NO_GLES), 1)
219221
$(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL2) -lGL -o $@$(EXT)
220222
else
221223
@echo gles has been disabled
222224
endif
223225

224-
examples/egl/egl: examples/egl/egl.c RGFW.h xdg-shell.c
226+
examples/egl/egl: examples/egl/egl.c RGFW.h $(WAYLAND_SOURCE)
225227
ifneq ($(NO_EGL), 1)
226228
$(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL1) -lGL -lEGL -o $@$(EXT)
227229
else
@@ -230,15 +232,15 @@ endif
230232

231233

232234

233-
examples/osmesa_demo/osmesa_demo: examples/osmesa_demo/osmesa_demo.c RGFW.h xdg-shell.c
235+
examples/osmesa_demo/osmesa_demo: examples/osmesa_demo/osmesa_demo.c RGFW.h $(WAYLAND_SOURCE)
234236
ifneq ($(NO_OSMESA), 1)
235237
$(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_OSMESA) -lOSMesa -o $@$(EXT)
236238
else
237239
@echo osmesa has been disabled
238240
endif
239241

240242

241-
examples/vk10/vk10: examples/vk10/vk10.c examples/vk10/vkinit.h RGFW.h xdg-shell.c
243+
examples/vk10/vk10: examples/vk10/vk10.c examples/vk10/vkinit.h RGFW.h $(WAYLAND_SOURCE)
242244
ifneq ($(NO_VULKAN), 1)
243245
glslangValidator -V examples/vk10/shaders/vert.vert -o examples/vk10/shaders/vert.h --vn vert_code
244246
glslangValidator -V examples/vk10/shaders/frag.frag -o examples/vk10/shaders/frag.h --vn frag_code
@@ -255,7 +257,7 @@ else
255257
$(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL1) $(DX11_LIBS) -D RGFW_NO_VULKAN -o $@
256258
endif
257259

258-
examples/dx11/dx11: examples/dx11/dx11.c RGFW.h xdg-shell.c
260+
examples/dx11/dx11: examples/dx11/dx11.c RGFW.h $(WAYLAND_SOURCE)
259261
ifeq ($(CC), zig cc)
260262
@echo directX is not supported with Zig
261263
else ifneq (,$(filter $(CC),g++ clang++ "zig cc"))
@@ -267,14 +269,14 @@ else
267269
endif
268270

269271

270-
examples/metal/metal: examples/metal/metal.m RGFW.h xdg-shell.c
272+
examples/metal/metal: examples/metal/metal.m RGFW.h $(WAYLAND_SOURCE)
271273
ifeq ($(detected_OS),Darwin) # Mac OS X
272274
$(CC) $(CFLAGS) examples/metal/metal.m -I. -framework CoreVideo -framework Metal -framework Cocoa -framework IOKit -framework QuartzCore -o $@
273275
else
274276
@echo metal is not supported on $(detected_OS)
275277
endif
276278

277-
examples/minimal_links/minimal_links: examples/minimal_links/minimal_links.c RGFW.h xdg-shell.c
279+
examples/minimal_links/minimal_links: examples/minimal_links/minimal_links.c RGFW.h $(WAYLAND_SOURCE)
278280
ifeq ($(WAYLAND), 1)
279281
@echo nostl is not supported on this platform
280282
else ifneq (,$(filter $(CC),emcc em++))
@@ -292,7 +294,7 @@ else
292294
endif
293295

294296

295-
examples/nostl/nostl: examples/nostl/nostl.c RGFW.h xdg-shell.c
297+
examples/nostl/nostl: examples/nostl/nostl.c RGFW.h $(WAYLAND_SOURCE)
296298
ifeq ($(WAYLAND), 1)
297299
@echo nostl is not supported on this platform
298300
else ifneq (,$(filter $(CC),emcc em++))
@@ -308,7 +310,7 @@ else
308310
endif
309311

310312

311-
examples/microui_demo/microui_demo: examples/microui_demo/microui_demo.c RGFW.h xdg-shell.c
313+
examples/microui_demo/microui_demo: examples/microui_demo/microui_demo.c RGFW.h $(WAYLAND_SOURCE)
312314
ifeq (,$(filter $(CC),emcc em++ g++ clang++))
313315
$(CC) $(CFLAGS) -I. $< examples/microui_demo/microui.c $(LINK_GL1) $(LIBS) -o $@$(EXT)
314316
else ifneq (,$(filter $(CC),em++ g++ clang++))
@@ -317,18 +319,18 @@ else
317319
$(CC) $(CFLAGS) -I. $< examples/microui_demo/microui.c -s USE_WEBGL2 $(LIBS) $(LINK_GL1) -o $@$(EXT)
318320
endif
319321

320-
examples/window_icons/icons: examples/window_icons/icons.c RGFW.h xdg-shell.c
322+
examples/window_icons/icons: examples/window_icons/icons.c RGFW.h $(WAYLAND_SOURCE)
321323
$(CC) $(CFLAGS) -I. $< $(LIBS) -lm $(LINK_GL1) -o $@$(EXT)
322-
examples/mouse_icons/icons: examples/mouse_icons/icons.c RGFW.h xdg-shell.c
324+
examples/mouse_icons/icons: examples/mouse_icons/icons.c RGFW.h $(WAYLAND_SOURCE)
323325
$(CC) $(CFLAGS) -I. $< $(LIBS) -lm $(LINK_GL1) -o $@$(EXT)
324-
examples/gamepad/gamepad: examples/gamepad/gamepad.c RGFW.h xdg-shell.c
326+
examples/gamepad/gamepad: examples/gamepad/gamepad.c RGFW.h $(WAYLAND_SOURCE)
325327
$(CC) $(CFLAGS) -I. $< $(LIBS) -lm $(LINK_GL1) -o $@$(EXT)
326328

327-
examples/first-person-camera/camera: examples/first-person-camera/camera.c RGFW.h xdg-shell.c
329+
examples/first-person-camera/camera: examples/first-person-camera/camera.c RGFW.h $(WAYLAND_SOURCE)
328330
$(CC) $(CFLAGS) -I. $< $(LIBS) -lm $(LINK_GL1) -o $@$(EXT)
329331

330332

331-
examples/gl33/gl33: examples/gl33/gl33.c RGFW.h xdg-shell.c
333+
examples/gl33/gl33: examples/gl33/gl33.c RGFW.h $(WAYLAND_SOURCE)
332334
ifeq ($(WAYLAND), 1)
333335
$(CC) $(CFLAGS) $(WARNINGS) -I. $< -lm $(LIBS) $(LINK_GL1) -lEGL -lwayland-egl -o $@$(EXT)
334336
else ifeq ($(detected_OS),NetBSD)
@@ -343,10 +345,10 @@ else
343345
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) $(LINK_GL3) -o $@$(EXT)
344346
endif
345347

346-
$(EXAMPLE_OUTPUTS): %: %.c RGFW.h xdg-shell.c
348+
$(EXAMPLE_OUTPUTS): %: %.c RGFW.h $(WAYLAND_SOURCE)
347349
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LINK_GL1) $(LIBS) $($) -o $@$(EXT)
348350

349-
$(TEST_OUTPUTS): %: %.c RGFW.h xdg-shell.c
351+
$(TEST_OUTPUTS): %: %.c RGFW.h $(WAYLAND_SOURCE)
350352
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LINK_GL1) $(LIBS) $($) -o $@$(EXT)
351353
@for exe in $(TEST_OUTPUTS); do \
352354
echo "Running $$exe..."; \
@@ -379,7 +381,7 @@ endif
379381
$(MAKE) clean
380382

381383

382-
RGFW$(OBJ_FILE): RGFW.h xdg-shell.c
384+
RGFW$(OBJ_FILE): RGFW.h $(WAYLAND_SOURCE)
383385
#$(CC) -x c $(CUSTOM_CFLAGS) -c RGFW.h -D RGFW_IMPLEMENTATION -fPIC -D RGFW_EXPORT
384386
cp RGFW.h RGFW.c
385387
$(CC) $(CUSTOM_CFLAGS) -c RGFW.c -D RGFW_IMPLEMENTATION -fPIC -D RGFW_EXPORT
@@ -397,9 +399,11 @@ libRGFW.a: RGFW.h RGFW$(OBJ_FILE)
397399
$(MAKE) RGFW$(OBJ_FILE)
398400
$(AR) rcs libRGFW.a RGFW$(OBJ_FILE)
399401

400-
xdg-shell.c:
401402
ifeq ($(WAYLAND),1)
403+
404+
$(WAYLAND_SOURCE): %.c:
402405
$(MAKE) -f wayland.mk
406+
403407
endif
404408

405409

RGFW.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,6 +3215,7 @@ struct RGFW_info {
32153215

32163216
struct wl_data_device_manager *data_device_manager;
32173217
struct wl_data_device *data_device; // supports clipboard and DND
3218+
struct wp_pointer_warp_v1* wp_pointer_warp;
32183219

32193220
struct wl_keyboard* wl_keyboard;
32203221
struct wl_pointer* wl_pointer;
@@ -8595,7 +8596,7 @@ struct wl_surface* RGFW_window_getWindow_Wayland(RGFW_window* win) { return win-
85958596
#include "relative-pointer-unstable-v1.h"
85968597
#include "pointer-constraints-unstable-v1.h"
85978598
#include "xdg-output-unstable-v1.h"
8598-
8599+
#include "pointer-warp-v1.h"
85998600

86008601
void RGFW_toggleWaylandMaximized(RGFW_window* win, RGFW_bool maximized);
86018602

@@ -9239,6 +9240,8 @@ static void RGFW_wl_global_registry_handler(void* data, struct wl_registry *regi
92399240
RGFW->xdg_output_manager = wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1);
92409241
} else if (RGFW_STRNCMP(interface,"wl_output", 10) == 0) {
92419242
RGFW_wl_create_outputs(registry, id);
9243+
} else if (RGFW_STRNCMP(interface, wp_pointer_warp_v1_interface.name, 255) == 0) {
9244+
RGFW->wp_pointer_warp = wl_registry_bind(registry, id, &wp_pointer_warp_v1_interface, 1);
92429245
} else if (RGFW_STRNCMP(interface,"wl_data_device_manager", 23) == 0) {
92439246
RGFW->data_device_manager = wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
92449247
}
@@ -9430,6 +9433,10 @@ void RGFW_deinitPlatform_Wayland(void) {
94309433
wl_cursor_theme_destroy(_RGFW->wl_cursor_theme);
94319434
}
94329435

9436+
if (_RGFW->wp_pointer_warp != NULL) {
9437+
wp_pointer_warp_v1_destroy(_RGFW->wp_pointer_warp);
9438+
}
9439+
94339440
RGFW_freeMouse(_RGFW->hiddenMouse);
94349441

94359442
RGFW_monitorNode* node = _RGFW->monitors.list.head;
@@ -9977,7 +9984,9 @@ void RGFW_FUNC(RGFW_freeMouse)(RGFW_mouse* mouse) {
99779984
}
99789985

99799986
void RGFW_FUNC(RGFW_window_moveMouse)(RGFW_window* win, i32 x, i32 y) {
9980-
RGFW_UNUSED(win); RGFW_UNUSED(x); RGFW_UNUSED(y);
9987+
if (_RGFW->wp_pointer_warp != NULL) {
9988+
wp_pointer_warp_v1_warp_pointer(_RGFW->wp_pointer_warp, win->src.surface, _RGFW->wl_pointer, wl_fixed_from_int(x), wl_fixed_from_int(y), _RGFW->mouse_enter_serial);
9989+
}
99819990
}
99829991

99839992
RGFW_bool RGFW_FUNC(RGFW_window_setMouseDefault)(RGFW_window* win) {

RGFW.o

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)