Skip to content

Commit

Permalink
JBR-6253 Wayland: can't run in weston because of xdg_wm_base version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mkartashev authored and jbrbot committed Nov 8, 2024
1 parent 5ad4f8a commit 79ddf65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/java.desktop/unix/native/libawt_wlawt/WLComponentPeer.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,14 @@ Java_sun_awt_wl_WLComponentPeer_nativeRepositionWLPopup
struct WLFrame *frame = jlong_to_ptr(ptr);
assert (!frame->toplevel);

struct xdg_positioner *xdg_positioner = newPositioner(parentX, parentY, parentWidth, parentHeight,
width, height, offsetX, offsetY);
CHECK_NULL(xdg_positioner);
static int token = 42; // This will be received by xdg_popup_repositioned(); unused for now.
xdg_popup_reposition(frame->xdg_popup, xdg_positioner, token++);
xdg_positioner_destroy(xdg_positioner);
if (wl_proxy_get_version((struct wl_proxy *)xdg_wm_base) >= 3) {
struct xdg_positioner *xdg_positioner = newPositioner(parentX, parentY, parentWidth, parentHeight,
width, height, offsetX, offsetY);
CHECK_NULL(xdg_positioner);
static int token = 42; // This will be received by xdg_popup_repositioned(); unused for now.
xdg_popup_reposition(frame->xdg_popup, xdg_positioner, token++);
xdg_positioner_destroy(xdg_positioner);
}
}

static void
Expand Down
5 changes: 4 additions & 1 deletion src/java.desktop/unix/native/libawt_wlawt/WLToolkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,10 @@ registry_global(void *data, struct wl_registry *wl_registry,
} else if (strcmp(interface, wl_compositor_interface.name) == 0) {
wl_compositor = wl_registry_bind(wl_registry, name, &wl_compositor_interface, 4);
} else if (strcmp(interface, xdg_wm_base_interface.name) == 0) {
xdg_wm_base = wl_registry_bind(wl_registry, name, &xdg_wm_base_interface, 3);
// Need version 3, but can work with version 1.
// The version will be checked at the point of use.
int wm_base_version = MIN(3, version);
xdg_wm_base = wl_registry_bind(wl_registry, name, &xdg_wm_base_interface, wm_base_version);
if (xdg_wm_base != NULL) {
xdg_wm_base_add_listener(xdg_wm_base, &xdg_wm_base_listener, NULL);
process_new_listener_before_end_of_init();
Expand Down

0 comments on commit 79ddf65

Please sign in to comment.