mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
Use MetaMonitorManager insted of MetaDisplay where possible
This drops display's monitors-changed signal and makes all the code rely on MetaMonitorManager. https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
parent
43f9cd537e
commit
e8171ccdc1
@ -949,11 +949,13 @@ get_top_visible_window_actor (MetaCompositor *compositor)
|
|||||||
MetaWindowActor *window_actor = l->data;
|
MetaWindowActor *window_actor = l->data;
|
||||||
MetaWindow *window = meta_window_actor_get_meta_window (window_actor);
|
MetaWindow *window = meta_window_actor_get_meta_window (window_actor);
|
||||||
MetaRectangle buffer_rect;
|
MetaRectangle buffer_rect;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
|
|
||||||
meta_window_get_buffer_rect (window, &buffer_rect);
|
meta_window_get_buffer_rect (window, &buffer_rect);
|
||||||
|
meta_display_get_size (compositor->display,
|
||||||
|
&display_rect.width, &display_rect.height);
|
||||||
|
|
||||||
if (meta_rectangle_overlap (&compositor->display->rect,
|
if (meta_rectangle_overlap (&display_rect, &buffer_rect))
|
||||||
&buffer_rect))
|
|
||||||
return window_actor;
|
return window_actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <meta/util.h>
|
#include <meta/util.h>
|
||||||
#include <meta/meta-background.h>
|
#include <meta/meta-background.h>
|
||||||
#include <meta/meta-background-image.h>
|
#include <meta/meta-background-image.h>
|
||||||
|
#include <meta/meta-monitor-manager.h>
|
||||||
#include "meta-background-private.h"
|
#include "meta-background-private.h"
|
||||||
#include "cogl-utils.h"
|
#include "cogl-utils.h"
|
||||||
|
|
||||||
@ -151,8 +152,7 @@ invalidate_monitor_backgrounds (MetaBackground *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_monitors_changed (MetaDisplay *display,
|
on_monitors_changed (MetaBackground *self)
|
||||||
MetaBackground *self)
|
|
||||||
{
|
{
|
||||||
invalidate_monitor_backgrounds (self);
|
invalidate_monitor_backgrounds (self);
|
||||||
}
|
}
|
||||||
@ -163,21 +163,8 @@ set_display (MetaBackground *self,
|
|||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
MetaBackgroundPrivate *priv = self->priv;
|
||||||
|
|
||||||
if (priv->display)
|
|
||||||
{
|
|
||||||
g_signal_handlers_disconnect_by_func (priv->display,
|
|
||||||
(gpointer)on_monitors_changed,
|
|
||||||
self);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_set_object (&priv->display, display);
|
g_set_object (&priv->display, display);
|
||||||
|
|
||||||
if (priv->display)
|
|
||||||
{
|
|
||||||
g_signal_connect (priv->display, "monitors-changed",
|
|
||||||
G_CALLBACK (on_monitors_changed), self);
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidate_monitor_backgrounds (self);
|
invalidate_monitor_backgrounds (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,11 +316,16 @@ meta_background_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
MetaBackground *self = META_BACKGROUND (object);
|
MetaBackground *self = META_BACKGROUND (object);
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
MetaBackgroundPrivate *priv = self->priv;
|
||||||
|
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
|
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
|
||||||
|
|
||||||
g_signal_connect_object (priv->display, "gl-video-memory-purged",
|
g_signal_connect_object (priv->display, "gl-video-memory-purged",
|
||||||
G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
|
G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
g_signal_connect_object (monitor_manager, "monitors-changed",
|
||||||
|
G_CALLBACK (on_monitors_changed), self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <meta/window.h>
|
#include <meta/window.h>
|
||||||
#include <meta/meta-background-group.h>
|
#include <meta/meta-background-group.h>
|
||||||
#include <meta/meta-background-actor.h>
|
#include <meta/meta-background-actor.h>
|
||||||
|
#include <meta/meta-monitor-manager.h>
|
||||||
#include <meta/util.h>
|
#include <meta/util.h>
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
@ -319,10 +320,12 @@ on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_monitors_changed (MetaDisplay *display,
|
on_monitors_changed (MetaMonitorManager *monitor_manager,
|
||||||
MetaPlugin *plugin)
|
MetaPlugin *plugin)
|
||||||
{
|
{
|
||||||
MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
|
MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
|
||||||
|
MetaDisplay *display = meta_plugin_get_display (plugin);
|
||||||
|
|
||||||
int i, n;
|
int i, n;
|
||||||
GRand *rand = g_rand_new_with_seed (123456);
|
GRand *rand = g_rand_new_with_seed (123456);
|
||||||
|
|
||||||
@ -374,15 +377,16 @@ start (MetaPlugin *plugin)
|
|||||||
{
|
{
|
||||||
MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
|
MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
|
||||||
MetaDisplay *display = meta_plugin_get_display (plugin);
|
MetaDisplay *display = meta_plugin_get_display (plugin);
|
||||||
|
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||||
|
|
||||||
self->priv->background_group = meta_background_group_new ();
|
self->priv->background_group = meta_background_group_new ();
|
||||||
clutter_actor_insert_child_below (meta_get_window_group_for_display (display),
|
clutter_actor_insert_child_below (meta_get_window_group_for_display (display),
|
||||||
self->priv->background_group, NULL);
|
self->priv->background_group, NULL);
|
||||||
|
|
||||||
g_signal_connect (display, "monitors-changed",
|
g_signal_connect (monitor_manager, "monitors-changed",
|
||||||
G_CALLBACK (on_monitors_changed), plugin);
|
G_CALLBACK (on_monitors_changed), plugin);
|
||||||
|
|
||||||
on_monitors_changed (display, plugin);
|
on_monitors_changed (monitor_manager, plugin);
|
||||||
|
|
||||||
clutter_actor_show (meta_get_stage_for_display (display));
|
clutter_actor_show (meta_get_stage_for_display (display));
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,6 @@ struct _MetaDisplay
|
|||||||
|
|
||||||
MetaStartupNotification *startup_notification;
|
MetaStartupNotification *startup_notification;
|
||||||
|
|
||||||
MetaRectangle rect; /* Size of screen; rect.x & rect.y are always 0 */
|
|
||||||
MetaCursor current_cursor;
|
MetaCursor current_cursor;
|
||||||
|
|
||||||
MetaStack *stack;
|
MetaStack *stack;
|
||||||
|
@ -144,7 +144,6 @@ enum
|
|||||||
IN_FULLSCREEN_CHANGED,
|
IN_FULLSCREEN_CHANGED,
|
||||||
SHOWING_DESKTOP_CHANGED,
|
SHOWING_DESKTOP_CHANGED,
|
||||||
STARTUP_SEQUENCE_CHANGED,
|
STARTUP_SEQUENCE_CHANGED,
|
||||||
MONITORS_CHANGED,
|
|
||||||
RESTACKED,
|
RESTACKED,
|
||||||
WORKAREAS_CHANGED,
|
WORKAREAS_CHANGED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
@ -170,9 +169,6 @@ static MetaDisplay *the_display = NULL;
|
|||||||
static void on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
static void on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
||||||
MetaDisplay *display);
|
MetaDisplay *display);
|
||||||
|
|
||||||
static void on_monitors_changed (MetaMonitorManager *monitor_manager,
|
|
||||||
MetaDisplay *display);
|
|
||||||
|
|
||||||
static void prefs_changed_callback (MetaPreference pref,
|
static void prefs_changed_callback (MetaPreference pref,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
@ -516,13 +512,6 @@ meta_display_class_init (MetaDisplayClass *klass)
|
|||||||
0, NULL, NULL, NULL,
|
0, NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
||||||
|
|
||||||
display_signals[MONITORS_CHANGED] =
|
|
||||||
g_signal_new ("monitors-changed",
|
|
||||||
G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
0, NULL, NULL, NULL,
|
|
||||||
G_TYPE_NONE, 0);
|
|
||||||
|
|
||||||
display_signals[RESTACKED] =
|
display_signals[RESTACKED] =
|
||||||
g_signal_new ("restacked",
|
g_signal_new ("restacked",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
@ -743,7 +732,6 @@ meta_display_open (void)
|
|||||||
display->focus_window = NULL;
|
display->focus_window = NULL;
|
||||||
display->x11_display = NULL;
|
display->x11_display = NULL;
|
||||||
|
|
||||||
display->rect.x = display->rect.y = 0;
|
|
||||||
display->current_cursor = -1; /* invalid/unset */
|
display->current_cursor = -1; /* invalid/unset */
|
||||||
display->tile_preview_timeout_id = 0;
|
display->tile_preview_timeout_id = 0;
|
||||||
display->check_fullscreen_later = 0;
|
display->check_fullscreen_later = 0;
|
||||||
@ -794,12 +782,6 @@ meta_display_open (void)
|
|||||||
monitor_manager = meta_backend_get_monitor_manager (backend);
|
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||||
g_signal_connect (monitor_manager, "monitors-changed-internal",
|
g_signal_connect (monitor_manager, "monitors-changed-internal",
|
||||||
G_CALLBACK (on_monitors_changed_internal), display);
|
G_CALLBACK (on_monitors_changed_internal), display);
|
||||||
g_signal_connect (monitor_manager, "monitors-changed",
|
|
||||||
G_CALLBACK (on_monitors_changed), display);
|
|
||||||
|
|
||||||
meta_monitor_manager_get_screen_size (monitor_manager,
|
|
||||||
&display->rect.width,
|
|
||||||
&display->rect.height);
|
|
||||||
|
|
||||||
meta_display_set_cursor (display, META_CURSOR_DEFAULT);
|
meta_display_set_cursor (display, META_CURSOR_DEFAULT);
|
||||||
|
|
||||||
@ -2763,11 +2745,20 @@ meta_display_get_size (MetaDisplay *display,
|
|||||||
int *width,
|
int *width,
|
||||||
int *height)
|
int *height)
|
||||||
{
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
MetaMonitorManager *monitor_manager =
|
||||||
|
meta_backend_get_monitor_manager (backend);
|
||||||
|
int display_width, display_height;
|
||||||
|
|
||||||
|
meta_monitor_manager_get_screen_size (monitor_manager,
|
||||||
|
&display_width,
|
||||||
|
&display_height);
|
||||||
|
|
||||||
if (width != NULL)
|
if (width != NULL)
|
||||||
*width = display->rect.width;
|
*width = display_width;
|
||||||
|
|
||||||
if (height != NULL)
|
if (height != NULL)
|
||||||
*height = display->rect.height;
|
*height = display_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3078,10 +3069,6 @@ on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
|||||||
MetaBackend *backend;
|
MetaBackend *backend;
|
||||||
MetaCursorRenderer *cursor_renderer;
|
MetaCursorRenderer *cursor_renderer;
|
||||||
|
|
||||||
meta_monitor_manager_get_screen_size (monitor_manager,
|
|
||||||
&display->rect.width,
|
|
||||||
&display->rect.height);
|
|
||||||
|
|
||||||
reload_logical_monitors (display);
|
reload_logical_monitors (display);
|
||||||
|
|
||||||
/* Fix up monitor for all windows on this display */
|
/* Fix up monitor for all windows on this display */
|
||||||
@ -3100,13 +3087,6 @@ on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
|||||||
meta_cursor_renderer_force_update (cursor_renderer);
|
meta_cursor_renderer_force_update (cursor_renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
on_monitors_changed (MetaMonitorManager *monitor_manager,
|
|
||||||
MetaDisplay *display)
|
|
||||||
{
|
|
||||||
g_signal_emit (display, display_signals[MONITORS_CHANGED], 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_display_restacked (MetaDisplay *display)
|
meta_display_restacked (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
|
@ -1064,14 +1064,18 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
|||||||
{
|
{
|
||||||
GList *new_edges;
|
GList *new_edges;
|
||||||
MetaEdge *new_edge;
|
MetaEdge *new_edge;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
MetaRectangle reduced;
|
MetaRectangle reduced;
|
||||||
|
|
||||||
|
meta_display_get_size (display,
|
||||||
|
&display_rect.width, &display_rect.height);
|
||||||
|
|
||||||
/* We don't care about snapping to any portion of the window that
|
/* We don't care about snapping to any portion of the window that
|
||||||
* is offscreen (we also don't care about parts of edges covered
|
* is offscreen (we also don't care about parts of edges covered
|
||||||
* by other windows or DOCKS, but that's handled below).
|
* by other windows or DOCKS, but that's handled below).
|
||||||
*/
|
*/
|
||||||
meta_rectangle_intersect (&cur_rect,
|
meta_rectangle_intersect (&cur_rect,
|
||||||
&display->rect,
|
&display_rect,
|
||||||
&reduced);
|
&reduced);
|
||||||
|
|
||||||
new_edges = NULL;
|
new_edges = NULL;
|
||||||
|
@ -5618,13 +5618,17 @@ meta_window_recalc_features (MetaWindow *window)
|
|||||||
if (!window->has_resize_func)
|
if (!window->has_resize_func)
|
||||||
{
|
{
|
||||||
window->has_maximize_func = FALSE;
|
window->has_maximize_func = FALSE;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
|
|
||||||
|
meta_display_get_size (window->display, &display_rect.width,
|
||||||
|
&display_rect.height);
|
||||||
|
|
||||||
/* don't allow fullscreen if we can't resize, unless the size
|
/* don't allow fullscreen if we can't resize, unless the size
|
||||||
* is entire screen size (kind of broken, because we
|
* is entire screen size (kind of broken, because we
|
||||||
* actually fullscreen to monitor size not screen size)
|
* actually fullscreen to monitor size not screen size)
|
||||||
*/
|
*/
|
||||||
if (window->size_hints.min_width == window->display->rect.width &&
|
if (window->size_hints.min_width == display_rect.width &&
|
||||||
window->size_hints.min_height == window->display->rect.height)
|
window->size_hints.min_height == display_rect.height)
|
||||||
; /* leave fullscreen available */
|
; /* leave fullscreen available */
|
||||||
else
|
else
|
||||||
window->has_fullscreen_func = FALSE;
|
window->has_fullscreen_func = FALSE;
|
||||||
@ -6511,9 +6515,14 @@ meta_window_get_work_area_all_monitors (MetaWindow *window,
|
|||||||
MetaRectangle *area)
|
MetaRectangle *area)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
|
|
||||||
|
meta_display_get_size (window->display,
|
||||||
|
&display_rect.width,
|
||||||
|
&display_rect.height);
|
||||||
|
|
||||||
/* Initialize to the whole display */
|
/* Initialize to the whole display */
|
||||||
*area = window->display->rect;
|
*area = display_rect;
|
||||||
|
|
||||||
tmp = meta_window_get_workspaces (window);
|
tmp = meta_window_get_workspaces (window);
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
@ -6732,9 +6741,13 @@ warp_grab_pointer (MetaWindow *window,
|
|||||||
int *y)
|
int *y)
|
||||||
{
|
{
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
|
|
||||||
display = window->display;
|
display = window->display;
|
||||||
|
meta_display_get_size (display,
|
||||||
|
&display_rect.width,
|
||||||
|
&display_rect.height);
|
||||||
|
|
||||||
/* We may not have done begin_grab_op yet, i.e. may not be in a grab
|
/* We may not have done begin_grab_op yet, i.e. may not be in a grab
|
||||||
*/
|
*/
|
||||||
@ -6759,8 +6772,8 @@ warp_grab_pointer (MetaWindow *window,
|
|||||||
*y += rect.y;
|
*y += rect.y;
|
||||||
|
|
||||||
/* Avoid weird bouncing at the screen edge; see bug 154706 */
|
/* Avoid weird bouncing at the screen edge; see bug 154706 */
|
||||||
*x = CLAMP (*x, 0, window->display->rect.width-1);
|
*x = CLAMP (*x, 0, display_rect.width - 1);
|
||||||
*y = CLAMP (*y, 0, window->display->rect.height-1);
|
*y = CLAMP (*y, 0, display_rect.height - 1);
|
||||||
|
|
||||||
meta_error_trap_push (display->x11_display);
|
meta_error_trap_push (display->x11_display);
|
||||||
|
|
||||||
|
@ -794,6 +794,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
GList *windows;
|
GList *windows;
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GList *logical_monitors, *l;
|
GList *logical_monitors, *l;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
MetaRectangle work_area;
|
MetaRectangle work_area;
|
||||||
|
|
||||||
if (!workspace->work_areas_invalid)
|
if (!workspace->work_areas_invalid)
|
||||||
@ -804,6 +805,10 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
g_assert (workspace->screen_edges == NULL);
|
g_assert (workspace->screen_edges == NULL);
|
||||||
g_assert (workspace->monitor_edges == NULL);
|
g_assert (workspace->monitor_edges == NULL);
|
||||||
|
|
||||||
|
meta_display_get_size (workspace->display,
|
||||||
|
&display_rect.width,
|
||||||
|
&display_rect.height);
|
||||||
|
|
||||||
/* STEP 1: Get the list of struts */
|
/* STEP 1: Get the list of struts */
|
||||||
|
|
||||||
workspace->all_struts = copy_strut_list (workspace->builtin_struts);
|
workspace->all_struts = copy_strut_list (workspace->builtin_struts);
|
||||||
@ -846,13 +851,13 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
|
|
||||||
workspace->screen_region =
|
workspace->screen_region =
|
||||||
meta_rectangle_get_minimal_spanning_set_for_region (
|
meta_rectangle_get_minimal_spanning_set_for_region (
|
||||||
&workspace->display->rect,
|
&display_rect,
|
||||||
workspace->all_struts);
|
workspace->all_struts);
|
||||||
|
|
||||||
/* STEP 3: Get the work areas (region-to-maximize-to) for the screen and
|
/* STEP 3: Get the work areas (region-to-maximize-to) for the screen and
|
||||||
* monitors.
|
* monitors.
|
||||||
*/
|
*/
|
||||||
work_area = workspace->display->rect; /* start with the screen */
|
work_area = display_rect; /* start with the screen */
|
||||||
if (workspace->screen_region == NULL)
|
if (workspace->screen_region == NULL)
|
||||||
work_area = meta_rect (0, 0, -1, -1);
|
work_area = meta_rect (0, 0, -1, -1);
|
||||||
else
|
else
|
||||||
@ -869,7 +874,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
work_area.width, MIN_SANE_AREA);
|
work_area.width, MIN_SANE_AREA);
|
||||||
if (work_area.width < 1)
|
if (work_area.width < 1)
|
||||||
{
|
{
|
||||||
work_area.x = (workspace->display->rect.width - MIN_SANE_AREA)/2;
|
work_area.x = (display_rect.width - MIN_SANE_AREA)/2;
|
||||||
work_area.width = MIN_SANE_AREA;
|
work_area.width = MIN_SANE_AREA;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -886,7 +891,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
work_area.height, MIN_SANE_AREA);
|
work_area.height, MIN_SANE_AREA);
|
||||||
if (work_area.height < 1)
|
if (work_area.height < 1)
|
||||||
{
|
{
|
||||||
work_area.y = (workspace->display->rect.height - MIN_SANE_AREA)/2;
|
work_area.y = (display_rect.height - MIN_SANE_AREA)/2;
|
||||||
work_area.height = MIN_SANE_AREA;
|
work_area.height = MIN_SANE_AREA;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -953,7 +958,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
|||||||
g_assert (workspace->screen_edges == NULL);
|
g_assert (workspace->screen_edges == NULL);
|
||||||
g_assert (workspace->monitor_edges == NULL);
|
g_assert (workspace->monitor_edges == NULL);
|
||||||
workspace->screen_edges =
|
workspace->screen_edges =
|
||||||
meta_rectangle_find_onscreen_edges (&workspace->display->rect,
|
meta_rectangle_find_onscreen_edges (&display_rect,
|
||||||
workspace->all_struts);
|
workspace->all_struts);
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
for (l = logical_monitors; l; l = l->next)
|
for (l = logical_monitors; l; l = l->next)
|
||||||
@ -1005,8 +1010,11 @@ meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
|||||||
MetaMonitorManager *monitor_manager =
|
MetaMonitorManager *monitor_manager =
|
||||||
meta_backend_get_monitor_manager (backend);
|
meta_backend_get_monitor_manager (backend);
|
||||||
MetaDisplay *display = workspace->display;
|
MetaDisplay *display = workspace->display;
|
||||||
|
MetaRectangle display_rect = { 0 };
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
|
meta_display_get_size (display, &display_rect.width, &display_rect.height);
|
||||||
|
|
||||||
for (l = struts; l; l = l->next)
|
for (l = struts; l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaStrut *strut = l->data;
|
MetaStrut *strut = l->data;
|
||||||
@ -1033,7 +1041,7 @@ meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
|||||||
META_DISPLAY_DOWN))
|
META_DISPLAY_DOWN))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strut->rect.height = display->rect.height - strut->rect.y;
|
strut->rect.height = display_rect.height - strut->rect.y;
|
||||||
break;
|
break;
|
||||||
case META_SIDE_LEFT:
|
case META_SIDE_LEFT:
|
||||||
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
||||||
@ -1050,7 +1058,7 @@ meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
|||||||
META_DISPLAY_RIGHT))
|
META_DISPLAY_RIGHT))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strut->rect.width = display->rect.width - strut->rect.x;
|
strut->rect.width = display_rect.width - strut->rect.x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ static const char *net_wm_name = "Mutter";
|
|||||||
static char *get_screen_name (Display *xdisplay,
|
static char *get_screen_name (Display *xdisplay,
|
||||||
int number);
|
int number);
|
||||||
|
|
||||||
static void on_monitors_changed (MetaDisplay *display,
|
static void on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
||||||
MetaX11Display *x11_display);
|
MetaX11Display *x11_display);
|
||||||
|
|
||||||
static void update_cursor_theme (MetaX11Display *x11_display);
|
static void update_cursor_theme (MetaX11Display *x11_display);
|
||||||
@ -507,12 +507,15 @@ static void
|
|||||||
set_desktop_geometry_hint (MetaX11Display *x11_display)
|
set_desktop_geometry_hint (MetaX11Display *x11_display)
|
||||||
{
|
{
|
||||||
unsigned long data[2];
|
unsigned long data[2];
|
||||||
|
int monitor_width, monitor_height;
|
||||||
|
|
||||||
if (x11_display->display->closing > 0)
|
if (x11_display->display->closing > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data[0] = x11_display->display->rect.width;
|
meta_display_get_size (x11_display->display, &monitor_width, &monitor_height);
|
||||||
data[1] = x11_display->display->rect.height;
|
|
||||||
|
data[0] = monitor_width;
|
||||||
|
data[1] = monitor_height;
|
||||||
|
|
||||||
meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu\n", data[0], data[1]);
|
meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu\n", data[0], data[1]);
|
||||||
|
|
||||||
@ -993,6 +996,9 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
|||||||
GdkDisplay *gdk_display;
|
GdkDisplay *gdk_display;
|
||||||
const char *gdk_gl_env = NULL;
|
const char *gdk_gl_env = NULL;
|
||||||
const char *xdisplay_name;
|
const char *xdisplay_name;
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
MetaMonitorManager *monitor_manager =
|
||||||
|
meta_backend_get_monitor_manager (backend);
|
||||||
|
|
||||||
xdisplay_name = g_getenv ("DISPLAY");
|
xdisplay_name = g_getenv ("DISPLAY");
|
||||||
if (!xdisplay_name)
|
if (!xdisplay_name)
|
||||||
@ -1158,9 +1164,9 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
|||||||
x11_display->group_prop_hooks = NULL;
|
x11_display->group_prop_hooks = NULL;
|
||||||
meta_x11_display_init_group_prop_hooks (x11_display);
|
meta_x11_display_init_group_prop_hooks (x11_display);
|
||||||
|
|
||||||
g_signal_connect_object (display,
|
g_signal_connect_object (monitor_manager,
|
||||||
"monitors-changed",
|
"monitors-changed-internal",
|
||||||
G_CALLBACK (on_monitors_changed),
|
G_CALLBACK (on_monitors_changed_internal),
|
||||||
x11_display,
|
x11_display,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
@ -1554,6 +1560,11 @@ create_guard_window (MetaX11Display *x11_display)
|
|||||||
XSetWindowAttributes attributes;
|
XSetWindowAttributes attributes;
|
||||||
Window guard_window;
|
Window guard_window;
|
||||||
gulong create_serial;
|
gulong create_serial;
|
||||||
|
int display_width, display_height;
|
||||||
|
|
||||||
|
meta_display_get_size (x11_display->display,
|
||||||
|
&display_width,
|
||||||
|
&display_height);
|
||||||
|
|
||||||
attributes.event_mask = NoEventMask;
|
attributes.event_mask = NoEventMask;
|
||||||
attributes.override_redirect = True;
|
attributes.override_redirect = True;
|
||||||
@ -1566,8 +1577,8 @@ create_guard_window (MetaX11Display *x11_display)
|
|||||||
x11_display->xroot,
|
x11_display->xroot,
|
||||||
0, /* x */
|
0, /* x */
|
||||||
0, /* y */
|
0, /* y */
|
||||||
x11_display->display->rect.width,
|
display_width,
|
||||||
x11_display->display->rect.height,
|
display_height,
|
||||||
0, /* border width */
|
0, /* border width */
|
||||||
0, /* depth */
|
0, /* depth */
|
||||||
InputOnly, /* class */
|
InputOnly, /* class */
|
||||||
@ -1618,9 +1629,15 @@ meta_x11_display_create_guard_window (MetaX11Display *x11_display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_monitors_changed (MetaDisplay *display,
|
on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
||||||
MetaX11Display *x11_display)
|
MetaX11Display *x11_display)
|
||||||
{
|
{
|
||||||
|
int display_width, display_height;
|
||||||
|
|
||||||
|
meta_monitor_manager_get_screen_size (monitor_manager,
|
||||||
|
&display_width,
|
||||||
|
&display_height);
|
||||||
|
|
||||||
set_desktop_geometry_hint (x11_display);
|
set_desktop_geometry_hint (x11_display);
|
||||||
|
|
||||||
/* Resize the guard window to fill the screen again. */
|
/* Resize the guard window to fill the screen again. */
|
||||||
@ -1630,8 +1647,8 @@ on_monitors_changed (MetaDisplay *display,
|
|||||||
|
|
||||||
changes.x = 0;
|
changes.x = 0;
|
||||||
changes.y = 0;
|
changes.y = 0;
|
||||||
changes.width = display->rect.width;
|
changes.width = display_width;
|
||||||
changes.height = display->rect.height;
|
changes.height = display_height;
|
||||||
|
|
||||||
XConfigureWindow (x11_display->xdisplay,
|
XConfigureWindow (x11_display->xdisplay,
|
||||||
x11_display->guard_window,
|
x11_display->guard_window,
|
||||||
|
@ -1343,9 +1343,10 @@ meta_window_x11_update_struts (MetaWindow *window)
|
|||||||
strut_begin = struts[4+(i*2)];
|
strut_begin = struts[4+(i*2)];
|
||||||
strut_end = struts[4+(i*2)+1];
|
strut_end = struts[4+(i*2)+1];
|
||||||
|
|
||||||
temp = g_new (MetaStrut, 1);
|
temp = g_new0 (MetaStrut, 1);
|
||||||
temp->side = 1 << i; /* See MetaSide def. Matches nicely, eh? */
|
temp->side = 1 << i; /* See MetaSide def. Matches nicely, eh? */
|
||||||
temp->rect = window->display->rect;
|
meta_display_get_size (window->display,
|
||||||
|
&temp->rect.width, &temp->rect.height);
|
||||||
switch (temp->side)
|
switch (temp->side)
|
||||||
{
|
{
|
||||||
case META_SIDE_RIGHT:
|
case META_SIDE_RIGHT:
|
||||||
@ -1406,9 +1407,10 @@ meta_window_x11_update_struts (MetaWindow *window)
|
|||||||
if (thickness == 0)
|
if (thickness == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
temp = g_new (MetaStrut, 1);
|
temp = g_new0 (MetaStrut, 1);
|
||||||
temp->side = 1 << i;
|
temp->side = 1 << i;
|
||||||
temp->rect = window->display->rect;
|
meta_display_get_size (window->display,
|
||||||
|
&temp->rect.width, &temp->rect.height);
|
||||||
switch (temp->side)
|
switch (temp->side)
|
||||||
{
|
{
|
||||||
case META_SIDE_RIGHT:
|
case META_SIDE_RIGHT:
|
||||||
|
Loading…
Reference in New Issue
Block a user