Skip to content

Commit

Permalink
Compute screen height properly when not in X11
Browse files Browse the repository at this point in the history
Don't use that value uninitialized
  • Loading branch information
lukefromdc committed Nov 22, 2024
1 parent 0ec86be commit 96a8c54
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions stickynotes/stickynotes_applet.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet)
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;

else
{
/*No root window or primary monitor in wayland unless compositors add it back*/
GdkRectangle geometry = {0};
GdkMonitor *monitor;
monitor = gdk_display_get_monitor (gdk_screen_get_display (screen), 0);
gdk_monitor_get_geometry (monitor, &geometry);
screen_height = geometry.height;
}
#endif

stickynotes->max_height = (int) (0.8 * (double) screen_height);
Expand Down

0 comments on commit 96a8c54

Please sign in to comment.