Skip to content

Commit 9aee1bb

Browse files
committed
nemo-icon-container.c: Fix positioning of interactive search.
1 parent 93cf0c5 commit 9aee1bb

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

libnemo-private/nemo-icon-container.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3620,6 +3620,28 @@ nemo_icon_container_search_position_func (NemoIconContainer *container,
36203620
if (nemo_icon_container_get_is_desktop (container)) {
36213621
x = cont_x + cont_width - requisition.width;
36223622
y = cont_y + cont_height - requisition.height;
3623+
3624+
if (eel_check_is_wayland ()) {
3625+
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
3626+
GdkWindow *parent_window = gtk_widget_get_window (toplevel);
3627+
gint parent_x, parent_y;
3628+
3629+
gdk_window_get_origin (parent_window, &parent_x, &parent_y);
3630+
3631+
GdkRectangle anchor_rect = {
3632+
x - parent_x,
3633+
y - parent_y,
3634+
1, 1
3635+
};
3636+
3637+
gdk_window_move_to_rect (gtk_widget_get_window (search_dialog),
3638+
&anchor_rect,
3639+
GDK_GRAVITY_NORTH_WEST,
3640+
GDK_GRAVITY_NORTH_WEST,
3641+
0,
3642+
0, 0);
3643+
return;
3644+
}
36233645
} else {
36243646
if (cont_x + cont_width > monitor.x + monitor.width) {
36253647
x = monitor.x + monitor.width - requisition.width;
@@ -4082,6 +4104,17 @@ nemo_icon_container_ensure_interactive_directory (NemoIconContainer *container)
40824104
gtk_container_add (GTK_CONTAINER (vbox), container->details->search_entry);
40834105

40844106
gtk_widget_realize (container->details->search_entry);
4107+
4108+
if (eel_check_is_wayland () && nemo_icon_container_get_is_desktop (container)) {
4109+
GdkRectangle anchor_rect = { 0, 0, 1, 1 };
4110+
4111+
gdk_window_move_to_rect (gtk_widget_get_window (container->details->search_window),
4112+
&anchor_rect,
4113+
GDK_GRAVITY_NORTH_WEST,
4114+
GDK_GRAVITY_NORTH_WEST,
4115+
0,
4116+
0, 0);
4117+
}
40854118
}
40864119

40874120
/* Pops up the interactive search entry. If keybinding is TRUE then the user

0 commit comments

Comments
 (0)