2010-11-12 12:18:58 +00:00
|
|
|
/*
|
|
|
|
* gdkscreen-broadway.c
|
|
|
|
*
|
|
|
|
* Copyright 2001 Sun Microsystems Inc.
|
|
|
|
*
|
|
|
|
* Erwann Chenede <erwann.chenede@sun.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2010-11-12 12:18:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gdkscreen-broadway.h"
|
|
|
|
|
|
|
|
#include "gdkscreen.h"
|
|
|
|
#include "gdkdisplay.h"
|
|
|
|
#include "gdkdisplay-broadway.h"
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2012-02-21 16:19:35 +00:00
|
|
|
static void gdk_broadway_screen_dispose (GObject *object);
|
|
|
|
static void gdk_broadway_screen_finalize (GObject *object);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
G_DEFINE_TYPE (GdkBroadwayScreen, gdk_broadway_screen, GDK_TYPE_SCREEN)
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
static void
|
2011-01-06 22:36:44 +00:00
|
|
|
gdk_broadway_screen_init (GdkBroadwayScreen *screen)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static GdkDisplay *
|
|
|
|
gdk_broadway_screen_get_display (GdkScreen *screen)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-01-06 22:36:44 +00:00
|
|
|
return GDK_BROADWAY_SCREEN (screen)->display;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static GdkWindow *
|
|
|
|
gdk_broadway_screen_get_root_window (GdkScreen *screen)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-01-06 22:36:44 +00:00
|
|
|
return GDK_BROADWAY_SCREEN (screen)->root_window;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-04-07 13:10:39 +00:00
|
|
|
void
|
2012-02-21 16:19:35 +00:00
|
|
|
_gdk_broadway_screen_size_changed (GdkScreen *screen,
|
|
|
|
BroadwayInputScreenResizeNotify *msg)
|
2011-04-07 13:10:39 +00:00
|
|
|
{
|
|
|
|
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
2016-04-03 03:42:40 +00:00
|
|
|
GdkMonitor *monitor;
|
2016-09-09 12:53:18 +00:00
|
|
|
GdkRectangle size;
|
2015-06-26 11:49:23 +00:00
|
|
|
GList *toplevels, *l;
|
2011-04-07 13:10:39 +00:00
|
|
|
|
2016-09-09 12:53:18 +00:00
|
|
|
monitor = GDK_BROADWAY_DISPLAY (broadway_screen->display)->monitor;
|
|
|
|
gdk_monitor_get_geometry (monitor, &size);
|
2011-04-07 13:10:39 +00:00
|
|
|
|
2016-09-09 12:53:18 +00:00
|
|
|
if (msg->width == size.width &&
|
|
|
|
msg->height == size.height)
|
2015-06-26 11:49:23 +00:00
|
|
|
return;
|
|
|
|
|
2016-04-03 03:42:40 +00:00
|
|
|
gdk_monitor_set_size (monitor, msg->width, msg->height);
|
|
|
|
gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
|
|
|
|
|
2015-06-26 11:49:23 +00:00
|
|
|
toplevels = gdk_screen_get_toplevel_windows (screen);
|
|
|
|
for (l = toplevels; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
GdkWindow *toplevel = l->data;
|
|
|
|
GdkWindowImplBroadway *toplevel_impl = GDK_WINDOW_IMPL_BROADWAY (toplevel->impl);
|
|
|
|
|
|
|
|
if (toplevel_impl->maximized)
|
2016-09-09 12:53:18 +00:00
|
|
|
gdk_window_move_resize (toplevel, 0, 0, msg->width, msg->height);
|
2015-06-26 11:49:23 +00:00
|
|
|
}
|
2011-04-07 13:10:39 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
static void
|
2011-01-06 22:36:44 +00:00
|
|
|
gdk_broadway_screen_dispose (GObject *object)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (object);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
if (broadway_screen->root_window)
|
|
|
|
_gdk_window_destroy (broadway_screen->root_window, TRUE);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
G_OBJECT_CLASS (gdk_broadway_screen_parent_class)->dispose (object);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-01-06 22:36:44 +00:00
|
|
|
gdk_broadway_screen_finalize (GObject *object)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (object);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
if (broadway_screen->root_window)
|
|
|
|
g_object_unref (broadway_screen->root_window);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
G_OBJECT_CLASS (gdk_broadway_screen_parent_class)->finalize (object);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
GdkScreen *
|
2010-11-16 11:33:02 +00:00
|
|
|
_gdk_broadway_screen_new (GdkDisplay *display,
|
2011-01-06 22:36:44 +00:00
|
|
|
gint screen_number)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
GdkScreen *screen;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayScreen *broadway_screen;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
screen = g_object_new (GDK_TYPE_BROADWAY_SCREEN, NULL);
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
|
|
|
broadway_screen->display = display;
|
|
|
|
_gdk_broadway_screen_init_root_window (screen);
|
2010-11-15 19:08:18 +00:00
|
|
|
|
|
|
|
return screen;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_broadway_screen_get_setting (GdkScreen *screen,
|
|
|
|
const gchar *name,
|
|
|
|
GValue *value)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
void
|
2011-01-06 22:36:44 +00:00
|
|
|
_gdk_broadway_screen_events_init (GdkScreen *screen)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->dispose = gdk_broadway_screen_dispose;
|
|
|
|
object_class->finalize = gdk_broadway_screen_finalize;
|
|
|
|
|
|
|
|
screen_class->get_display = gdk_broadway_screen_get_display;
|
|
|
|
screen_class->get_root_window = gdk_broadway_screen_get_root_window;
|
|
|
|
screen_class->get_setting = gdk_broadway_screen_get_setting;
|
|
|
|
}
|
|
|
|
|