[gnome-panel] notification-area: stop using deprecated API from GdkScreen
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] notification-area: stop using deprecated API from GdkScreen
- Date: Mon, 31 Oct 2016 15:43:59 +0000 (UTC)
commit 085e39381a40d067565f96ca02dab8f2b11d84ac
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Oct 31 14:13:29 2016 +0200
notification-area: stop using deprecated API from GdkScreen
applets/notification-area/fixedtip.c | 36 +++++++++++++++-----------
applets/notification-area/na-tray-manager.c | 8 +----
2 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/applets/notification-area/fixedtip.c b/applets/notification-area/fixedtip.c
index d3876b4..a1e0159 100644
--- a/applets/notification-area/fixedtip.c
+++ b/applets/notification-area/fixedtip.c
@@ -127,22 +127,31 @@ na_fixed_tip_init (NaFixedTip *fixedtip)
}
static void
+get_monitor_geometry (GdkWindow *window,
+ GdkRectangle *geometry)
+{
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+
+ display = gdk_display_get_default ();
+ monitor = gdk_display_get_monitor_at_window (display, window);
+
+ gdk_monitor_get_geometry (monitor, geometry);
+}
+
+static void
na_fixed_tip_position (NaFixedTip *fixedtip)
{
- GdkScreen *screen;
GdkWindow *parent_window;
+ GdkRectangle monitor;
GtkRequisition req;
int root_x;
int root_y;
int parent_width;
int parent_height;
- int screen_width;
- int screen_height;
- screen = gtk_widget_get_screen (fixedtip->priv->parent);
parent_window = gtk_widget_get_window (fixedtip->priv->parent);
-
- gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
+ get_monitor_geometry (parent_window, &monitor);
gtk_widget_get_preferred_size (GTK_WIDGET (fixedtip), &req, NULL);
@@ -150,33 +159,30 @@ na_fixed_tip_position (NaFixedTip *fixedtip)
parent_width = gdk_window_get_width (parent_window);
parent_height = gdk_window_get_height (parent_window);
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
-
/* pad between panel and message window */
#define PAD 5
if (fixedtip->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- if (root_x <= screen_width / 2)
+ if (root_x <= monitor.width / 2)
root_x += parent_width + PAD;
else
root_x -= req.width + PAD;
}
else
{
- if (root_y <= screen_height / 2)
+ if (root_y <= monitor.height / 2)
root_y += parent_height + PAD;
else
root_y -= req.height + PAD;
}
/* Push onscreen */
- if ((root_x + req.width) > screen_width)
- root_x = screen_width - req.width;
+ if ((root_x + req.width) > monitor.width)
+ root_x = monitor.width - req.width;
- if ((root_y + req.height) > screen_height)
- root_y = screen_height - req.height;
+ if ((root_y + req.height) > monitor.height)
+ root_y = monitor.height - req.height;
gtk_window_move (GTK_WINDOW (fixedtip), root_x, root_y);
}
diff --git a/applets/notification-area/na-tray-manager.c b/applets/notification-area/na-tray-manager.c
index 6d5a845..58b91b5 100644
--- a/applets/notification-area/na-tray-manager.c
+++ b/applets/notification-area/na-tray-manager.c
@@ -24,12 +24,8 @@
#include "na-tray-manager.h"
-#if defined (GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
-#elif defined (GDK_WINDOWING_WIN32)
-#include <gdk/gdkwin32.h>
-#endif
#include <gtk/gtk.h>
/* Signals */
@@ -779,7 +775,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
GDK_PROPERTY_CHANGE_MASK | GDK_STRUCTURE_MASK);
selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
- gdk_screen_get_number (screen));
+ gdk_x11_screen_get_screen_number (screen));
manager->selection_atom = gdk_atom_intern (selection_atom_name, FALSE);
g_free (selection_atom_name);
@@ -883,7 +879,7 @@ na_tray_manager_check_running_screen_x11 (GdkScreen *screen)
display = gdk_screen_get_display (screen);
selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
- gdk_screen_get_number (screen));
+ gdk_x11_screen_get_screen_number (screen));
selection_atom = gdk_x11_get_xatom_by_name_for_display (display,
selection_atom_name);
g_free (selection_atom_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]