diff options
author | lukefromdc <[email protected]> | 2023-06-20 01:35:12 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-07-17 02:47:28 +0200 |
commit | ce52935ec89bacd417ca6065012986e83a920f48 (patch) | |
tree | 282e8fa40b6589f831c24e9f894d8872d7d3575d /stickynotes/stickynotes_applet.c | |
parent | 6133a03263321ab85fae9299968a8f069b3dfad5 (diff) | |
download | mate-applets-ce52935ec89bacd417ca6065012986e83a920f48.tar.bz2 mate-applets-ce52935ec89bacd417ca6065012986e83a920f48.tar.xz |
stickynotes: port to in-process for wayland
- Note that functions involving measuring or clicking on the desktop
- Are x11 only as wayland does not allow one app to access another's windows
- Fix warnings on removal of applet
- use wnck only in x11
- Cleanup X11 checks
Diffstat (limited to 'stickynotes/stickynotes_applet.c')
-rw-r--r-- | stickynotes/stickynotes_applet.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c index fd903e1e..88785fb3 100644 --- a/stickynotes/stickynotes_applet.c +++ b/stickynotes/stickynotes_applet.c @@ -84,7 +84,7 @@ stickynotes_applet_factory (MatePanelApplet *mate_panel_applet, } /* Sticky Notes applet factory */ -MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("StickyNotesAppletFactory", +MATE_PANEL_APPLET_IN_PROCESS_FACTORY ("StickyNotesAppletFactory", PANEL_TYPE_APPLET, "stickynotes_applet", stickynotes_applet_factory, @@ -167,6 +167,7 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet) cairo_t *cr; gint size, scale; int screen_height; + GdkScreen *screen; stickynotes = g_new (StickyNotes, 1); @@ -177,7 +178,6 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet) size = mate_panel_applet_get_size (mate_panel_applet); scale = gtk_widget_get_scale_factor (GTK_WIDGET (mate_panel_applet)); - g_set_application_name (_("Sticky Notes")); gtk_window_set_default_icon_name ("mate-sticky-notes-applet"); stickynotes->icon_normal = @@ -208,14 +208,22 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet) g_signal_connect (stickynotes->settings, "changed", G_CALLBACK (preferences_apply_cb), NULL); - /* Max height for large notes*/ - screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())); + /* Max height for large notes in x11 only + * In wayland we do not have access to global screen dimensions + */ + + screen = gtk_widget_get_screen (GTK_WIDGET (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; +#endif + stickynotes->max_height = (int) (0.8 * (double) screen_height); /* Load sticky notes */ - stickynotes_load (gtk_widget_get_screen (GTK_WIDGET (mate_panel_applet))); + stickynotes_load (screen); - install_check_click_on_desktop (); + install_check_click_on_desktop (screen); } void |