[gnome-panel/wip-warnings-next] struts: remove GdkScreen from PanelStrut
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip-warnings-next] struts: remove GdkScreen from PanelStrut
- Date: Mon, 24 Feb 2020 21:20:08 +0000 (UTC)
commit 77db82ab446ac07738889fc2f7a1904a681072aa
Author: Sebastian Geiger <sbastig gmx net>
Date: Mon Feb 24 15:48:30 2020 +0100
struts: remove GdkScreen from PanelStrut
Since there should only be one GdkScreen for all monitors
we no longer need to track the GdkScreen pointer in
the PanelStrut struct. Instead we can use
gdk_screen_get_default() when needed.
gnome-panel/panel-struts.c | 51 ++++++++++++++++++--------------------------
gnome-panel/panel-struts.h | 1 -
gnome-panel/panel-toplevel.c | 1 -
3 files changed, 21 insertions(+), 32 deletions(-)
---
diff --git a/gnome-panel/panel-struts.c b/gnome-panel/panel-struts.c
index 709113b10..ccb6b8bec 100644
--- a/gnome-panel/panel-struts.c
+++ b/gnome-panel/panel-struts.c
@@ -30,7 +30,6 @@
typedef struct {
PanelToplevel *toplevel;
- GdkScreen *screen;
int monitor;
PanelOrientation orientation;
@@ -65,13 +64,16 @@ panel_struts_find_strut (PanelToplevel *toplevel)
}
static void
-panel_struts_get_monitor_geometry (GdkScreen *screen,
- int monitor,
+panel_struts_get_monitor_geometry (int monitor,
int *x,
int *y,
int *width,
int *height)
{
+ GdkScreen * screen;
+
+ screen = gdk_screen_get_default ();
+
*x = panel_multiscreen_x (screen, monitor);
*y = panel_multiscreen_y (screen, monitor);
*width = panel_multiscreen_width (screen, monitor);
@@ -181,7 +183,6 @@ panel_struts_allocation_overlapped (PanelStrut *strut,
static gboolean
panel_struts_allocate_struts (PanelToplevel *toplevel,
- GdkScreen *screen,
int monitor)
{
GSList *allocated = NULL;
@@ -197,10 +198,10 @@ panel_struts_allocate_struts (PanelToplevel *toplevel,
gboolean moved_down;
int skip;
- if (strut->screen != screen || strut->monitor != monitor)
+ if (strut->monitor != monitor)
continue;
- panel_struts_get_monitor_geometry (strut->screen, strut->monitor,
+ panel_struts_get_monitor_geometry (strut->monitor,
&monitor_x, &monitor_y,
&monitor_width, &monitor_height);
@@ -249,6 +250,7 @@ panel_struts_allocate_struts (PanelToplevel *toplevel,
void
panel_struts_set_window_hint (PanelToplevel *toplevel)
{
+ GdkScreen *screen;
GtkWidget *widget;
PanelStrut *strut;
int strut_size;
@@ -268,18 +270,18 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
strut_size = strut->allocated_strut_size;
- screen_width = gdk_screen_get_width (strut->screen);
- screen_height = gdk_screen_get_height (strut->screen);
+ screen = gdk_screen_get_default ();
- panel_struts_get_monitor_geometry (strut->screen,
- strut->monitor,
+ screen_width = gdk_screen_get_width (screen);
+ screen_height = gdk_screen_get_height (screen);
+
+ panel_struts_get_monitor_geometry (strut->monitor,
&monitor_x,
&monitor_y,
&monitor_width,
&monitor_height);
- panel_multiscreen_is_at_visible_extreme (strut->screen,
- strut->monitor,
+ panel_multiscreen_is_at_visible_extreme (strut->monitor,
&leftmost,
&rightmost,
&topmost,
@@ -347,20 +349,15 @@ orientation_to_order (PanelOrientation orientation)
}
/* Sort in order of
- * 1) screen
- * 2) monitor
- * 3) top, bottom, left, right
- * 4) strut_start ascending
- * 5) strut_end descending
+ * 1) monitor
+ * 2) top, bottom, left, right
+ * 3) strut_start ascending
+ * 4) strut_end descending
*/
static int
panel_struts_compare (const PanelStrut *s1,
const PanelStrut *s2)
{
- if (s1->screen != s2->screen)
- return gdk_screen_get_number (s1->screen) -
- gdk_screen_get_number (s2->screen);
-
if (s1->monitor != s2->monitor)
return s1->monitor - s2->monitor;
@@ -379,7 +376,6 @@ panel_struts_compare (const PanelStrut *s1,
gboolean
panel_struts_register_strut (PanelToplevel *toplevel,
- GdkScreen *screen,
int monitor,
PanelOrientation orientation,
int strut_size,
@@ -396,7 +392,6 @@ panel_struts_register_strut (PanelToplevel *toplevel,
} else if (strut->toplevel == toplevel &&
strut->orientation == orientation &&
- strut->screen == screen &&
strut->monitor == monitor &&
strut->strut_size == strut_size &&
strut->strut_start == strut_start &&
@@ -405,14 +400,12 @@ panel_struts_register_strut (PanelToplevel *toplevel,
strut->toplevel = toplevel;
strut->orientation = orientation;
- strut->screen = screen;
strut->monitor = monitor;
strut->strut_size = strut_size;
strut->strut_start = strut_start;
strut->strut_end = strut_end;
- panel_struts_get_monitor_geometry (screen, monitor,
- &monitor_x, &monitor_y,
+ panel_struts_get_monitor_geometry (&monitor_x, &monitor_y,
&monitor_width, &monitor_height);
switch (strut->orientation) {
@@ -451,26 +444,24 @@ panel_struts_register_strut (PanelToplevel *toplevel,
panel_struts_list = g_slist_sort (panel_struts_list,
(GCompareFunc) panel_struts_compare);
- return panel_struts_allocate_struts (toplevel, screen, monitor);
+ return panel_struts_allocate_struts (toplevel, monitor);
}
void
panel_struts_unregister_strut (PanelToplevel *toplevel)
{
PanelStrut *strut;
- GdkScreen *screen;
int monitor;
if (!(strut = panel_struts_find_strut (toplevel)))
return;
- screen = strut->screen;
monitor = strut->monitor;
panel_struts_list = g_slist_remove (panel_struts_list, strut);
g_free (strut);
- panel_struts_allocate_struts (toplevel, screen, monitor);
+ panel_struts_allocate_struts (toplevel, monitor);
}
gboolean
diff --git a/gnome-panel/panel-struts.h b/gnome-panel/panel-struts.h
index f4ef9af76..f06e351a2 100644
--- a/gnome-panel/panel-struts.h
+++ b/gnome-panel/panel-struts.h
@@ -27,7 +27,6 @@
G_BEGIN_DECLS
gboolean panel_struts_register_strut (PanelToplevel *toplevel,
- GdkScreen *screen,
int monitor,
PanelOrientation orientation,
int strut_size,
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index e9a1c23cf..c3395a0a2 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -1527,7 +1527,6 @@ panel_toplevel_update_struts (PanelToplevel *toplevel, gboolean end_of_animation
if (strut > 0)
geometry_changed = panel_struts_register_strut (toplevel,
- screen,
toplevel->priv->monitor,
orientation,
strut,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]