Use MetaRectangle for allocated returns
The conversion of GdkRectangle to a typedef for cairo_rectangle_int_t in GTK+-3 makes it no longer a proper boxed type (it's still registered boxed, but gobject-introspection doesn't know that.) So, switch to using MetaRectangle, which is now registered as a boxed type by Mutter. https://bugzilla.gnome.org/show_bug.cgi?id=621845
This commit is contained in:
parent
a45021bd60
commit
ab0d57d6ca
@ -1141,7 +1141,7 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global)
|
||||
*
|
||||
* Gets a list of the bounding boxes of the active screen's monitors.
|
||||
*
|
||||
* Return value: (transfer full) (element-type GdkRectangle): a list
|
||||
* Return value: (transfer full) (element-type Meta.Rectangle): a list
|
||||
* of monitor bounding boxes.
|
||||
*/
|
||||
GSList *
|
||||
@ -1152,17 +1152,11 @@ shell_global_get_monitors (ShellGlobal *global)
|
||||
MetaRectangle rect;
|
||||
int i;
|
||||
|
||||
g_assert (sizeof (MetaRectangle) == sizeof (GdkRectangle) &&
|
||||
G_STRUCT_OFFSET (MetaRectangle, x) == G_STRUCT_OFFSET (GdkRectangle, x) &&
|
||||
G_STRUCT_OFFSET (MetaRectangle, y) == G_STRUCT_OFFSET (GdkRectangle, y) &&
|
||||
G_STRUCT_OFFSET (MetaRectangle, width) == G_STRUCT_OFFSET (GdkRectangle, width) &&
|
||||
G_STRUCT_OFFSET (MetaRectangle, height) == G_STRUCT_OFFSET (GdkRectangle, height));
|
||||
|
||||
for (i = meta_screen_get_n_monitors (screen) - 1; i >= 0; i--)
|
||||
{
|
||||
meta_screen_get_monitor_geometry (screen, i, &rect);
|
||||
monitors = g_slist_prepend (monitors,
|
||||
g_boxed_copy (GDK_TYPE_RECTANGLE, &rect));
|
||||
meta_rectangle_copy (&rect));
|
||||
}
|
||||
return monitors;
|
||||
}
|
||||
@ -1176,11 +1170,12 @@ shell_global_get_monitors (ShellGlobal *global)
|
||||
*
|
||||
* Return value: the bounding box of the primary monitor
|
||||
*/
|
||||
GdkRectangle *
|
||||
MetaRectangle *
|
||||
shell_global_get_primary_monitor (ShellGlobal *global)
|
||||
{
|
||||
GdkScreen *screen = shell_global_get_gdk_screen (global);
|
||||
GdkRectangle rect;
|
||||
GdkRectangle gdk_rect;
|
||||
MetaRectangle rect;
|
||||
gint primary = 0;
|
||||
|
||||
/* gdk_screen_get_primary_monitor is only present in gtk-2.20+
|
||||
@ -1211,9 +1206,13 @@ shell_global_get_primary_monitor (ShellGlobal *global)
|
||||
primary = gdk_screen_get_primary_monitor (screen);
|
||||
#endif
|
||||
|
||||
gdk_screen_get_monitor_geometry (screen, primary, &rect);
|
||||
gdk_screen_get_monitor_geometry (screen, primary, &gdk_rect);
|
||||
rect.x = gdk_rect.x;
|
||||
rect.y = gdk_rect.y;
|
||||
rect.width = gdk_rect.width;
|
||||
rect.height = gdk_rect.height;
|
||||
|
||||
return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);
|
||||
return meta_rectangle_copy (&rect);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1225,7 +1224,7 @@ shell_global_get_primary_monitor (ShellGlobal *global)
|
||||
*
|
||||
* Return value: the bounding box of the focus monitor
|
||||
*/
|
||||
GdkRectangle *
|
||||
MetaRectangle *
|
||||
shell_global_get_focus_monitor (ShellGlobal *global)
|
||||
{
|
||||
MetaScreen *screen = shell_global_get_screen (global);
|
||||
@ -1247,12 +1246,12 @@ shell_global_get_focus_monitor (ShellGlobal *global)
|
||||
if (rect.x <= wrect.x && rect.y <= wrect.y &&
|
||||
rect.x + rect.width > wrect.x &&
|
||||
rect.y + rect.height > wrect.y)
|
||||
return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);
|
||||
return meta_rectangle_copy (&rect);
|
||||
}
|
||||
}
|
||||
|
||||
meta_screen_get_monitor_geometry (screen, 0, &rect);
|
||||
return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);
|
||||
return meta_rectangle_copy (&rect);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,8 +81,8 @@ void shell_global_format_time_relative_pretty (ShellGlobal *global, guint delta,
|
||||
ClutterActor *shell_global_create_root_pixmap_actor (ShellGlobal *global);
|
||||
|
||||
GSList *shell_global_get_monitors (ShellGlobal *global);
|
||||
GdkRectangle *shell_global_get_primary_monitor (ShellGlobal *global);
|
||||
GdkRectangle *shell_global_get_focus_monitor (ShellGlobal *global);
|
||||
MetaRectangle *shell_global_get_primary_monitor (ShellGlobal *global);
|
||||
MetaRectangle *shell_global_get_focus_monitor (ShellGlobal *global);
|
||||
|
||||
void shell_global_get_pointer (ShellGlobal *global,
|
||||
int *x,
|
||||
|
Loading…
Reference in New Issue
Block a user