Skip to content

Commit

Permalink
Guard against gdkx11 calls in a Wayland session.
Browse files Browse the repository at this point in the history
Fixes #3468
  • Loading branch information
mtwebster committed Oct 11, 2024
1 parent 0144434 commit b81ab12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions eel/eel-gtk-extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ eel_gtk_get_window_xid (GtkWindow *window)
{
g_return_val_if_fail (GTK_IS_WINDOW (window), 0);

if (eel_check_is_wayland ()) {
g_debug ("eel_gtk_get_window_xid: called on Wayland, returning 0");
return 0;
}

GdkWindow *gdkw = gtk_widget_get_window (GTK_WIDGET (window));
g_return_val_if_fail (GDK_IS_X11_WINDOW (gdkw), 0);

Expand Down
8 changes: 6 additions & 2 deletions src/nemo-main-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,12 @@ open_tabs_in_existing_window (NemoMainApplication *application,

/* Don't use `gtk_window_present()`, as the window manager will ignore this window's focus request and try
* to just mark it urgent instead (flashing in the window list for example). */
gtk_window_present_with_time (GTK_WINDOW (window),
gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window))));
if (eel_check_is_wayland ()) {
gtk_window_present (GTK_WINDOW (window));
} else {
gtk_window_present_with_time (GTK_WINDOW (window),
gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window))));
}

break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/nemo-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,8 @@ nemo_view_preview_files (NemoView *view,
uri = nemo_file_get_uri (files->data);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));

xid = gdk_x11_window_get_xid (gtk_widget_get_window (toplevel));
xid = eel_gtk_get_window_xid (GTK_WINDOW (toplevel));

nemo_previewer_call_show_file (previewer, uri, xid, TRUE);

g_free (uri);
Expand Down

0 comments on commit b81ab12

Please sign in to comment.