Update size of root window after display reconfiguration

This commit is contained in:
Kristian Rietveld 2009-10-26 08:53:20 +01:00
parent 959a9437e6
commit 93530675de
3 changed files with 29 additions and 17 deletions

View File

@ -105,11 +105,12 @@ extern GdkDragContext *_gdk_quartz_drag_source_context;
#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)win)->impl))
/* Initialization */
void _gdk_windowing_window_init (void);
void _gdk_events_init (void);
void _gdk_visual_init (void);
void _gdk_input_init (void);
void _gdk_quartz_event_loop_init (void);
void _gdk_windowing_update_root_window_size (GdkScreen *screen);
void _gdk_windowing_window_init (void);
void _gdk_events_init (void);
void _gdk_visual_init (void);
void _gdk_input_init (void);
void _gdk_quartz_event_loop_init (void);
/* GC */
typedef enum {

View File

@ -177,6 +177,8 @@ process_display_reconfiguration (GdkScreenQuartz *screen)
gdk_screen_quartz_calculate_layout (GDK_SCREEN_QUARTZ (screen));
_gdk_windowing_update_root_window_size (GDK_SCREEN (screen));
if (screen->emit_monitors_changed)
{
g_signal_emit_by_name (screen, "monitors-changed");

View File

@ -1090,6 +1090,26 @@ _gdk_window_impl_new (GdkWindow *window,
gdk_window_set_type_hint (window, attributes->type_hint);
}
void
_gdk_windowing_update_root_window_size (GdkScreen *screen)
{
GdkWindowObject *private = (GdkWindowObject *)_gdk_root;
/* The size of the root window is so that it can contain all
* monitors attached to this machine. The monitors are laid out
* within this root window. We calculate the size of the root window
* and the positions of the different monitors in gdkscreen-quartz.c.
*
* This data is updated when the monitor configuration is changed.
*/
private->x = 0;
private->y = 0;
private->abs_x = 0;
private->abs_y = 0;
private->width = gdk_screen_get_width (screen);
private->height = gdk_screen_get_height (screen);
}
void
_gdk_windowing_window_init (void)
{
@ -1107,18 +1127,7 @@ _gdk_windowing_window_init (void)
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);
/* The size of the root window should be the same as the size of
* the screen it belongs to.
*
* FIXME: Of course this needs to be updated when you change the monitor
* configuration (add another one, remove one, etc).
*/
private->x = 0;
private->y = 0;
private->abs_x = 0;
private->abs_y = 0;
private->width = gdk_screen_get_width (_gdk_screen);
private->height = gdk_screen_get_height (_gdk_screen);
_gdk_windowing_update_root_window_size (_gdk_screen);
private->state = 0; /* We don't want GDK_WINDOW_STATE_WITHDRAWN here */
private->window_type = GDK_WINDOW_ROOT;