summaryrefslogtreecommitdiff
path: root/mate-dictionary/src/gdict-aligned-window.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2023-08-09 07:17:27 -0400
committerLuke from DC <[email protected]>2023-08-12 19:08:16 +0000
commitf5ba27007c359c933631d30dac4593c147c5e01e (patch)
treedfaa438a9cce81b5f56ec4bf981181d50e282ddd /mate-dictionary/src/gdict-aligned-window.c
parent757b4728baab9f96808e05ab3d7fc5341b57f11a (diff)
downloadmate-utils-f5ba27007c359c933631d30dac4593c147c5e01e.tar.bz2
mate-utils-f5ba27007c359c933631d30dac4593c147c5e01e.tar.xz
dictionary applet: allow building in-process
*This is needed for wayland support
Diffstat (limited to 'mate-dictionary/src/gdict-aligned-window.c')
-rw-r--r--mate-dictionary/src/gdict-aligned-window.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/mate-dictionary/src/gdict-aligned-window.c b/mate-dictionary/src/gdict-aligned-window.c
index ed2a08fe..42a00cc9 100644
--- a/mate-dictionary/src/gdict-aligned-window.c
+++ b/mate-dictionary/src/gdict-aligned-window.c
@@ -154,8 +154,10 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
gint entry_x, entry_y, entry_width, entry_height;
gint x, y;
GdkGravity gravity = GDK_GRAVITY_NORTH_WEST;
- GdkWindow *gdk_window;
+ GdkWindow *gdk_window;
GdkDisplay *display;
+ GdkMonitor *monitor;
+ GdkRectangle geometry = {0};
g_assert (GDICT_IS_ALIGNED_WINDOW (window));
priv = window->priv;
@@ -185,7 +187,12 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
&entry_y);
gdk_window_get_geometry (gdk_window, NULL, NULL, &entry_width, &entry_height);
- if (entry_x + our_width < WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())))
+ /*Get the monitor dimensions*/
+ display= gdk_screen_get_display (gdk_screen_get_default ());
+ monitor = gdk_display_get_monitor (display, 0);
+ gdk_monitor_get_geometry (monitor, &geometry);
+
+ if (entry_x + our_width < geometry.width)
x = entry_x + 1;
else
{
@@ -194,7 +201,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
gravity = GDK_GRAVITY_NORTH_EAST;
}
- if (entry_y + entry_height + our_height < HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())))
+ if (entry_y + entry_height + our_height < geometry.height)
y = entry_y + entry_height - 1;
else
{