2010-11-12 12:18:58 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-2007 Peter Mattis, Spencer Kimball,
|
|
|
|
* Josh MacDonald, Ryan Lortie
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser 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
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gdkwindow-broadway.h"
|
2010-11-15 19:08:18 +00:00
|
|
|
#include "gdkscreen-broadway.h"
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2014-10-25 14:31:31 +00:00
|
|
|
#include "gdkbroadwaydisplay.h"
|
|
|
|
#include "gdkdisplay.h"
|
2010-11-12 12:18:58 +00:00
|
|
|
#include "gdkwindow.h"
|
|
|
|
#include "gdkwindowimpl.h"
|
|
|
|
#include "gdkdisplay-broadway.h"
|
|
|
|
#include "gdkprivate-broadway.h"
|
|
|
|
#include "gdkinternals.h"
|
|
|
|
#include "gdkdeviceprivate.h"
|
|
|
|
#include "gdkeventsource.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* Forward declarations */
|
2010-11-16 11:33:02 +00:00
|
|
|
static void gdk_window_impl_broadway_finalize (GObject *object);
|
2010-12-04 21:28:31 +00:00
|
|
|
|
|
|
|
static const cairo_user_data_key_t gdk_broadway_cairo_key;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
#define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \
|
2016-10-25 07:54:37 +00:00
|
|
|
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
#define WINDOW_IS_TOPLEVEL(window) \
|
|
|
|
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
|
2016-10-25 07:54:37 +00:00
|
|
|
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
struct _GdkBroadwayWindow {
|
|
|
|
GdkWindow parent;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GdkBroadwayWindowClass {
|
|
|
|
GdkWindowClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GdkBroadwayWindow, gdk_broadway_window, GDK_TYPE_WINDOW)
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_broadway_window_class_init (GdkBroadwayWindowClass *broadway_window_class)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_broadway_window_init (GdkBroadwayWindow *broadway_window)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
G_DEFINE_TYPE (GdkWindowImplBroadway,
|
|
|
|
gdk_window_impl_broadway,
|
|
|
|
GDK_TYPE_WINDOW_IMPL)
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2014-10-25 14:31:31 +00:00
|
|
|
static GdkDisplay *
|
|
|
|
find_broadway_display (void)
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
GSList *list, *l;
|
|
|
|
|
|
|
|
display = NULL;
|
|
|
|
|
|
|
|
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
|
|
|
for (l = list; l; l = l->next)
|
|
|
|
{
|
|
|
|
if (GDK_IS_BROADWAY_DISPLAY (l->data))
|
|
|
|
{
|
|
|
|
display = l->data;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_slist_free (list);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2013-03-28 18:22:42 +00:00
|
|
|
static void
|
|
|
|
update_dirty_windows_and_sync (void)
|
2010-11-16 21:11:53 +00:00
|
|
|
{
|
|
|
|
GList *l;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *display;
|
2013-03-28 18:22:42 +00:00
|
|
|
gboolean updated_surface;
|
2010-11-16 21:11:53 +00:00
|
|
|
|
2014-10-25 14:31:31 +00:00
|
|
|
display = GDK_BROADWAY_DISPLAY (find_broadway_display ());
|
|
|
|
g_assert (display != NULL);
|
2010-11-18 21:21:16 +00:00
|
|
|
|
2013-03-28 18:22:42 +00:00
|
|
|
updated_surface = FALSE;
|
2010-11-24 18:41:19 +00:00
|
|
|
for (l = display->toplevels; l != NULL; l = l->next)
|
2010-11-16 21:11:53 +00:00
|
|
|
{
|
|
|
|
GdkWindowImplBroadway *impl = l->data;
|
|
|
|
|
|
|
|
if (impl->dirty)
|
|
|
|
{
|
|
|
|
impl->dirty = FALSE;
|
2013-03-28 18:22:42 +00:00
|
|
|
updated_surface = TRUE;
|
2012-12-19 11:37:02 +00:00
|
|
|
_gdk_broadway_server_window_update (display->server,
|
|
|
|
impl->id,
|
|
|
|
impl->surface);
|
2010-11-16 21:11:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-19 11:37:02 +00:00
|
|
|
/* We sync here to ensure all references to the impl->surface memory
|
|
|
|
is done, as we may later paint new data in them. */
|
2013-03-28 18:22:42 +00:00
|
|
|
if (updated_surface)
|
|
|
|
gdk_display_sync (GDK_DISPLAY (display));
|
|
|
|
else
|
|
|
|
gdk_display_flush (GDK_DISPLAY (display));
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint flush_id = 0;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
flush_idle (gpointer data)
|
|
|
|
{
|
|
|
|
flush_id = 0;
|
|
|
|
|
2014-10-25 14:31:31 +00:00
|
|
|
gdk_display_flush (find_broadway_display ());
|
2010-11-16 21:11:53 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-03-28 18:22:42 +00:00
|
|
|
/* We need to flush in an idle rather than AFTER_PAINT, as the clock
|
|
|
|
is frozen during e.g. window resizes so the paint will not happen
|
|
|
|
and the window resize request is never flushed. */
|
2010-11-16 21:11:53 +00:00
|
|
|
static void
|
2013-03-28 18:22:42 +00:00
|
|
|
queue_flush (GdkWindow *window)
|
2010-11-16 21:11:53 +00:00
|
|
|
{
|
2013-03-28 18:22:42 +00:00
|
|
|
if (flush_id == 0)
|
2014-03-22 11:44:01 +00:00
|
|
|
{
|
|
|
|
flush_id = gdk_threads_add_idle (flush_idle, NULL);
|
|
|
|
g_source_set_name_by_id (flush_id, "[gtk+] flush_idle");
|
|
|
|
}
|
2010-11-16 21:11:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_impl_broadway_init (GdkWindowImplBroadway *impl)
|
|
|
|
{
|
2010-11-12 12:18:58 +00:00
|
|
|
impl->toplevel_window_type = -1;
|
|
|
|
impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL,
|
2011-10-15 12:35:28 +00:00
|
|
|
(GDestroyNotify) g_object_unref);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_impl_broadway_finalize (GObject *object)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-12-04 21:28:31 +00:00
|
|
|
GdkWindow *wrapper;
|
|
|
|
GdkWindowImplBroadway *impl;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2010-11-16 11:33:02 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_BROADWAY (object));
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (object);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
wrapper = impl->wrapper;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-04-15 14:17:27 +00:00
|
|
|
_gdk_broadway_window_grab_check_destroy (wrapper);
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
|
2010-11-25 19:07:26 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
|
2010-11-20 21:38:34 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (impl->cursor)
|
2011-10-15 12:35:28 +00:00
|
|
|
g_object_unref (impl->cursor);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
g_hash_table_destroy (impl->device_cursor);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display->toplevels = g_list_remove (broadway_display->toplevels, impl);
|
2010-11-15 20:44:38 +00:00
|
|
|
|
2010-11-16 11:33:02 +00:00
|
|
|
G_OBJECT_CLASS (gdk_window_impl_broadway_parent_class)->finalize (object);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-01-06 22:36:44 +00:00
|
|
|
_gdk_broadway_screen_init_root_window (GdkScreen * screen)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-12-04 21:28:31 +00:00
|
|
|
GdkWindow *window;
|
|
|
|
GdkWindowImplBroadway *impl;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayScreen *broadway_screen;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
g_assert (broadway_screen->root_window == NULL);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_screen->root_window = g_object_new (GDK_TYPE_BROADWAY_WINDOW, NULL);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
window = broadway_screen->root_window;
|
2010-12-04 21:54:45 +00:00
|
|
|
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL);
|
2010-12-04 21:28:31 +00:00
|
|
|
window->impl_window = window;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl->screen = screen;
|
|
|
|
impl->wrapper = window;
|
2012-12-19 11:37:02 +00:00
|
|
|
impl->id = 0;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
window->window_type = GDK_WINDOW_ROOT;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
window->x = 0;
|
|
|
|
window->y = 0;
|
|
|
|
window->abs_x = 0;
|
|
|
|
window->abs_y = 0;
|
2016-09-09 12:53:18 +00:00
|
|
|
window->width = 1024;
|
|
|
|
window->height = 768;
|
2010-12-04 21:28:31 +00:00
|
|
|
window->viewable = TRUE;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
_gdk_window_update_size (broadway_screen->root_window);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:22:42 +00:00
|
|
|
static void
|
|
|
|
on_frame_clock_after_paint (GdkFrameClock *clock,
|
|
|
|
GdkWindow *window)
|
|
|
|
{
|
|
|
|
update_dirty_windows_and_sync ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
connect_frame_clock (GdkWindow *window)
|
|
|
|
{
|
|
|
|
if (WINDOW_IS_TOPLEVEL (window))
|
|
|
|
{
|
|
|
|
GdkFrameClock *frame_clock = gdk_window_get_frame_clock (window);
|
|
|
|
|
|
|
|
g_signal_connect (frame_clock, "after-paint",
|
|
|
|
G_CALLBACK (on_frame_clock_after_paint), window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
void
|
2011-01-06 22:36:44 +00:00
|
|
|
_gdk_broadway_display_create_window_impl (GdkDisplay *display,
|
|
|
|
GdkWindow *window,
|
|
|
|
GdkWindow *real_parent,
|
|
|
|
GdkScreen *screen,
|
|
|
|
GdkEventMask event_mask,
|
2016-11-07 00:33:43 +00:00
|
|
|
GdkWindowAttr *attributes)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-16 11:33:02 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2010-12-04 21:54:45 +00:00
|
|
|
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL);
|
2010-12-04 21:28:31 +00:00
|
|
|
window->impl = (GdkWindowImpl *)impl;
|
2012-12-19 11:37:02 +00:00
|
|
|
impl->id = _gdk_broadway_server_new_window (broadway_display->server,
|
|
|
|
window->x,
|
|
|
|
window->y,
|
|
|
|
window->width,
|
|
|
|
window->height,
|
|
|
|
window->window_type == GDK_WINDOW_TEMP);
|
2011-01-06 22:36:44 +00:00
|
|
|
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), window);
|
2010-12-04 21:28:31 +00:00
|
|
|
impl->wrapper = window;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl->screen = screen;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
g_assert (window->window_type == GDK_WINDOW_TOPLEVEL ||
|
|
|
|
window->window_type == GDK_WINDOW_TEMP);
|
|
|
|
g_assert (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT);
|
2010-11-16 21:11:53 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
|
2013-03-28 18:22:42 +00:00
|
|
|
|
|
|
|
connect_frame_clock (window);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-04-06 14:39:07 +00:00
|
|
|
void
|
|
|
|
_gdk_broadway_window_resize_surface (GdkWindow *window)
|
2010-12-04 21:28:31 +00:00
|
|
|
{
|
|
|
|
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
|
|
|
if (impl->surface)
|
|
|
|
{
|
2013-04-03 13:46:21 +00:00
|
|
|
cairo_surface_destroy (impl->surface);
|
2010-12-04 21:28:31 +00:00
|
|
|
|
2012-12-21 23:02:55 +00:00
|
|
|
impl->surface = _gdk_broadway_server_create_surface (gdk_window_get_width (impl->wrapper),
|
|
|
|
gdk_window_get_height (impl->wrapper));
|
2010-12-04 21:28:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (impl->ref_surface)
|
|
|
|
{
|
|
|
|
cairo_surface_set_user_data (impl->ref_surface, &gdk_broadway_cairo_key,
|
|
|
|
NULL, NULL);
|
|
|
|
impl->ref_surface = NULL;
|
|
|
|
}
|
2011-04-06 14:39:07 +00:00
|
|
|
|
|
|
|
gdk_window_invalidate_rect (window, NULL, TRUE);
|
2010-12-04 21:28:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ref_surface_destroyed (void *data)
|
|
|
|
{
|
|
|
|
GdkWindowImplBroadway *impl = data;
|
|
|
|
|
|
|
|
impl->ref_surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static cairo_surface_t *
|
|
|
|
gdk_window_broadway_ref_cairo_surface (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
if (GDK_IS_WINDOW_IMPL_BROADWAY (window) &&
|
|
|
|
GDK_WINDOW_DESTROYED (impl->wrapper))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
w = gdk_window_get_width (impl->wrapper);
|
|
|
|
h = gdk_window_get_height (impl->wrapper);
|
|
|
|
|
|
|
|
/* Create actual backing store if missing */
|
|
|
|
if (!impl->surface)
|
2012-12-21 23:02:55 +00:00
|
|
|
impl->surface = _gdk_broadway_server_create_surface (w, h);
|
2010-12-04 21:28:31 +00:00
|
|
|
|
|
|
|
/* Create a destroyable surface referencing the real one */
|
|
|
|
if (!impl->ref_surface)
|
|
|
|
{
|
|
|
|
impl->ref_surface =
|
|
|
|
cairo_surface_create_for_rectangle (impl->surface,
|
|
|
|
0, 0,
|
|
|
|
w, h);
|
|
|
|
if (impl->ref_surface)
|
|
|
|
cairo_surface_set_user_data (impl->ref_surface, &gdk_broadway_cairo_key,
|
|
|
|
impl, ref_surface_destroyed);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cairo_surface_reference (impl->ref_surface);
|
|
|
|
|
|
|
|
return impl->ref_surface;
|
|
|
|
}
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
_gdk_broadway_window_destroy (GdkWindow *window,
|
2010-11-16 21:11:53 +00:00
|
|
|
gboolean recursing,
|
|
|
|
gboolean foreign_destroy)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-16 21:11:53 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2010-11-16 21:11:53 +00:00
|
|
|
|
2011-01-20 12:20:54 +00:00
|
|
|
_gdk_broadway_selection_window_destroyed (window);
|
2011-04-15 14:17:27 +00:00
|
|
|
_gdk_broadway_window_grab_check_destroy (window);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (impl->ref_surface)
|
|
|
|
{
|
|
|
|
cairo_surface_finish (impl->ref_surface);
|
|
|
|
cairo_surface_set_user_data (impl->ref_surface, &gdk_broadway_cairo_key,
|
|
|
|
NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (impl->surface)
|
|
|
|
{
|
|
|
|
cairo_surface_destroy (impl->surface);
|
|
|
|
impl->surface = NULL;
|
|
|
|
}
|
2010-11-16 21:11:53 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
|
2011-04-15 14:18:11 +00:00
|
|
|
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
|
|
|
|
|
2012-12-19 11:37:02 +00:00
|
|
|
_gdk_broadway_server_destroy_window (broadway_display->server,
|
|
|
|
impl->id);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function is called when the XWindow is really gone.
|
|
|
|
*/
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_destroy_notify (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
|
|
|
{
|
|
|
|
if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
|
2010-11-15 19:08:18 +00:00
|
|
|
g_warning ("GdkWindow %p unexpectedly destroyed", window);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
_gdk_window_destroy (window, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-16 21:11:53 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2010-11-15 21:12:04 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2011-04-11 09:56:22 +00:00
|
|
|
impl->visible = TRUE;
|
2010-11-15 21:12:04 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (window->event_mask & GDK_STRUCTURE_MASK)
|
|
|
|
_gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE);
|
2010-11-15 21:12:04 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (window->parent && window->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
|
|
|
|
_gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE);
|
2010-11-15 21:12:04 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
|
2012-12-19 11:37:02 +00:00
|
|
|
if (_gdk_broadway_server_window_show (broadway_display->server, impl->id))
|
2013-03-28 18:22:42 +00:00
|
|
|
queue_flush (window);
|
2012-12-19 11:37:02 +00:00
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_hide (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-16 21:11:53 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2011-04-11 09:56:22 +00:00
|
|
|
impl->visible = FALSE;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (window->event_mask & GDK_STRUCTURE_MASK)
|
|
|
|
_gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE);
|
2010-11-15 21:12:04 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (window->parent && window->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
|
|
|
|
_gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE);
|
2010-11-15 21:12:04 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
|
2013-04-05 15:06:09 +00:00
|
|
|
|
|
|
|
_gdk_broadway_window_grab_check_unmap (window,
|
|
|
|
_gdk_broadway_server_get_next_serial (broadway_display->server));
|
|
|
|
|
2012-12-19 11:37:02 +00:00
|
|
|
if (_gdk_broadway_server_window_hide (broadway_display->server, impl->id))
|
2013-03-28 18:22:42 +00:00
|
|
|
queue_flush (window);
|
2010-11-25 19:07:26 +00:00
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
_gdk_window_clear_update_area (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_withdraw (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_hide (window);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2010-11-21 19:46:50 +00:00
|
|
|
static void
|
|
|
|
gdk_window_broadway_move_resize (GdkWindow *window,
|
|
|
|
gboolean with_move,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-12-04 21:28:31 +00:00
|
|
|
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2013-01-08 16:33:29 +00:00
|
|
|
gboolean size_changed;
|
2010-11-23 11:52:10 +00:00
|
|
|
|
2013-01-08 16:33:29 +00:00
|
|
|
size_changed = FALSE;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-21 19:46:50 +00:00
|
|
|
if (width > 0 || height > 0)
|
|
|
|
{
|
|
|
|
if (width < 1)
|
|
|
|
width = 1;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-21 19:46:50 +00:00
|
|
|
if (height < 1)
|
|
|
|
height = 1;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (width != window->width ||
|
|
|
|
height != window->height)
|
2010-11-23 11:52:10 +00:00
|
|
|
{
|
2011-04-15 14:31:56 +00:00
|
|
|
size_changed = TRUE;
|
2010-11-23 11:52:10 +00:00
|
|
|
|
|
|
|
/* Resize clears the content */
|
|
|
|
impl->dirty = TRUE;
|
|
|
|
impl->last_synced = FALSE;
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
window->width = width;
|
|
|
|
window->height = height;
|
2011-04-06 14:39:07 +00:00
|
|
|
_gdk_broadway_window_resize_surface (window);
|
2010-11-23 11:52:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-08 16:33:29 +00:00
|
|
|
_gdk_broadway_server_window_move_resize (broadway_display->server,
|
|
|
|
impl->id,
|
|
|
|
with_move,
|
|
|
|
x, y,
|
|
|
|
window->width, window->height);
|
2013-03-28 18:22:42 +00:00
|
|
|
queue_flush (window);
|
2013-01-08 16:33:29 +00:00
|
|
|
if (size_changed)
|
|
|
|
window->resize_count++;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_raise (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_restack_toplevel (GdkWindow *window,
|
2011-03-14 10:21:37 +00:00
|
|
|
GdkWindow *sibling,
|
|
|
|
gboolean above)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_lower (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_focus (GdkWindow *window,
|
|
|
|
guint32 timestamp)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2013-11-12 11:03:50 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
GdkBroadwayDisplay *broadway_display;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!window->accept_focus)
|
|
|
|
return;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
|
|
|
|
_gdk_broadway_server_window_focus (broadway_display->server,
|
|
|
|
impl->id);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_type_hint (GdkWindow *window,
|
|
|
|
GdkWindowTypeHint hint)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static GdkWindowTypeHint
|
|
|
|
gdk_broadway_window_get_type_hint (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
return GDK_WINDOW_TYPE_HINT_NORMAL;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_modal_hint (GdkWindow *window,
|
|
|
|
gboolean modal)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_skip_taskbar_hint (GdkWindow *window,
|
|
|
|
gboolean skips_taskbar)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_skip_pager_hint (GdkWindow *window,
|
|
|
|
gboolean skips_pager)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_urgency_hint (GdkWindow *window,
|
|
|
|
gboolean urgent)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_geometry_hints (GdkWindow *window,
|
|
|
|
const GdkGeometry *geometry,
|
|
|
|
GdkWindowHints geom_mask)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2013-03-28 19:03:13 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
|
|
|
impl->geometry_hints = *geometry;
|
|
|
|
impl->geometry_hints_mask = geom_mask;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_title (GdkWindow *window,
|
|
|
|
const gchar *title)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
}
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_role (GdkWindow *window,
|
|
|
|
const gchar *role)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_startup_id (GdkWindow *window,
|
|
|
|
const gchar *startup_id)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_transient_for (GdkWindow *window,
|
|
|
|
GdkWindow *parent)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-04-05 10:02:46 +00:00
|
|
|
GdkBroadwayDisplay *display;
|
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
int parent_id;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
|
|
|
parent_id = 0;
|
|
|
|
if (parent)
|
|
|
|
parent_id = GDK_WINDOW_IMPL_BROADWAY (parent->impl)->id;
|
|
|
|
|
|
|
|
impl->transient_for = parent_id;
|
|
|
|
|
|
|
|
display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
|
2012-12-19 11:37:02 +00:00
|
|
|
_gdk_broadway_server_window_set_transient_for (display->server, impl->id, impl->transient_for);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_set_device_cursor (GdkWindow *window,
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkDevice *device,
|
|
|
|
GdkCursor *cursor)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-16 11:33:02 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
g_return_if_fail (GDK_IS_DEVICE (device));
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
if (!cursor)
|
|
|
|
g_hash_table_remove (impl->device_cursor, device);
|
|
|
|
else
|
|
|
|
{
|
2010-11-16 11:33:02 +00:00
|
|
|
_gdk_broadway_cursor_update_theme (cursor);
|
2010-11-12 12:18:58 +00:00
|
|
|
g_hash_table_replace (impl->device_cursor,
|
2013-03-24 18:21:41 +00:00
|
|
|
device, g_object_ref (cursor));
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
|
|
|
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_get_geometry (GdkWindow *window,
|
2011-01-06 22:36:44 +00:00
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-03-14 10:22:12 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
|
2011-03-16 14:48:24 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2011-03-14 10:22:12 +00:00
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
|
|
|
/* TODO: These should really roundtrip to the client to get the current data */
|
|
|
|
|
|
|
|
if (x)
|
|
|
|
*x = impl->wrapper->x;
|
|
|
|
if (y)
|
|
|
|
*y = impl->wrapper->y;
|
|
|
|
if (width)
|
|
|
|
*width = impl->wrapper->width;
|
|
|
|
if (height)
|
|
|
|
*height = impl->wrapper->height;
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 01:58:13 +00:00
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_get_root_coords (GdkWindow *window,
|
2011-03-14 10:22:12 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint *root_x,
|
|
|
|
gint *root_y)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-03-14 10:22:12 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
if (root_x)
|
2011-03-14 10:22:12 +00:00
|
|
|
*root_x = x + impl->wrapper->x;
|
2010-11-12 12:18:58 +00:00
|
|
|
if (root_y)
|
2011-03-14 10:22:12 +00:00
|
|
|
*root_y = y + impl->wrapper->y;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_get_frame_extents (GdkWindow *window,
|
|
|
|
GdkRectangle *rect)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (rect != NULL);
|
2010-11-15 19:08:18 +00:00
|
|
|
|
2011-03-14 10:22:12 +00:00
|
|
|
/* TODO: This should take wm frame into account */
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
rect->x = window->x;
|
|
|
|
rect->y = window->y;
|
|
|
|
rect->width = window->width;
|
|
|
|
rect->height = window->height;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_get_device_state (GdkWindow *window,
|
2010-11-24 20:28:38 +00:00
|
|
|
GdkDevice *device,
|
2013-07-03 09:52:58 +00:00
|
|
|
gdouble *x,
|
|
|
|
gdouble *y,
|
2010-11-24 20:28:38 +00:00
|
|
|
GdkModifierType *mask)
|
|
|
|
{
|
2011-03-11 07:26:37 +00:00
|
|
|
GdkWindow *child;
|
|
|
|
|
|
|
|
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), FALSE);
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
|
|
|
|
NULL, &child,
|
|
|
|
NULL, NULL,
|
|
|
|
x, y, mask);
|
|
|
|
return child != NULL;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GdkEventMask
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_get_events (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return 0;
|
2010-11-15 19:08:18 +00:00
|
|
|
|
|
|
|
return 0;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
2011-01-06 22:36:44 +00:00
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_set_events (GdkWindow *window,
|
2011-01-06 22:36:44 +00:00
|
|
|
GdkEventMask event_mask)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_shape_combine_region (GdkWindow *window,
|
2011-01-06 22:36:44 +00:00
|
|
|
const cairo_region_t *shape_region,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
static void
|
2010-11-16 11:33:02 +00:00
|
|
|
gdk_window_broadway_input_shape_combine_region (GdkWindow *window,
|
2011-01-06 22:36:44 +00:00
|
|
|
const cairo_region_t *shape_region,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_accept_focus (GdkWindow *window,
|
|
|
|
gboolean accept_focus)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
accept_focus = accept_focus != FALSE;
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (window->accept_focus != accept_focus)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-12-04 21:28:31 +00:00
|
|
|
window->accept_focus = accept_focus;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_focus_on_map (GdkWindow *window,
|
|
|
|
gboolean focus_on_map)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
focus_on_map = focus_on_map != FALSE;
|
|
|
|
|
2010-12-04 21:28:31 +00:00
|
|
|
if (window->focus_on_map != focus_on_map)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-12-04 21:28:31 +00:00
|
|
|
window->focus_on_map = focus_on_map;
|
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 void
|
|
|
|
gdk_broadway_window_set_icon_list (GdkWindow *window,
|
|
|
|
GList *pixbufs)
|
2010-11-15 19:08:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
2011-03-14 10:21:37 +00:00
|
|
|
gdk_broadway_window_set_icon_name (GdkWindow *window,
|
2011-01-06 22:36:44 +00:00
|
|
|
const gchar *name)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
g_object_set_qdata (G_OBJECT (window), g_quark_from_static_string ("gdk-icon-name-set"),
|
2011-03-14 10:21:37 +00:00
|
|
|
GUINT_TO_POINTER (name != NULL));
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_iconify (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_deiconify (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_stick (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_unstick (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_maximize (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2015-06-26 11:49:23 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
2016-09-09 12:53:18 +00:00
|
|
|
GdkDisplay *display;
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
GdkRectangle geom;
|
2015-06-26 11:49:23 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
2010-11-12 12:18:58 +00:00
|
|
|
return;
|
|
|
|
|
2015-06-26 11:49:23 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
|
|
|
if (impl->maximized)
|
|
|
|
return;
|
|
|
|
|
|
|
|
impl->maximized = TRUE;
|
|
|
|
|
|
|
|
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED);
|
|
|
|
|
|
|
|
impl->pre_maximize_x = window->x;
|
|
|
|
impl->pre_maximize_y = window->y;
|
|
|
|
impl->pre_maximize_width = window->width;
|
|
|
|
impl->pre_maximize_height = window->height;
|
|
|
|
|
2016-09-09 12:53:18 +00:00
|
|
|
display = gdk_window_get_display (window);
|
|
|
|
monitor = gdk_display_get_primary_monitor (display);
|
|
|
|
gdk_monitor_get_geometry (monitor, &geom);
|
2015-06-26 11:49:23 +00:00
|
|
|
|
2016-09-09 12:53:18 +00:00
|
|
|
gdk_window_move_resize (window,
|
|
|
|
geom.x, geom.y,
|
|
|
|
geom.width, geom.height);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_unmaximize (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2015-06-26 11:49:23 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2015-06-26 11:49:23 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
|
|
|
if (!impl->maximized)
|
|
|
|
return;
|
|
|
|
|
|
|
|
impl->maximized = FALSE;
|
|
|
|
|
|
|
|
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0);
|
|
|
|
|
|
|
|
gdk_window_move_resize (window,
|
|
|
|
impl->pre_maximize_x,
|
|
|
|
impl->pre_maximize_y,
|
|
|
|
impl->pre_maximize_width,
|
|
|
|
impl->pre_maximize_height);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_fullscreen (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
}
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_unfullscreen (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_keep_above (GdkWindow *window,
|
|
|
|
gboolean setting)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_keep_below (GdkWindow *window, gboolean setting)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static GdkWindow *
|
|
|
|
gdk_broadway_window_get_group (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL (window))
|
|
|
|
return NULL;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
return window;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_group (GdkWindow *window,
|
|
|
|
GdkWindow *leader)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_decorations (GdkWindow *window,
|
|
|
|
GdkWMDecoration decorations)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
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 gboolean
|
|
|
|
gdk_broadway_window_get_decorations (GdkWindow *window,
|
|
|
|
GdkWMDecoration *decorations)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
gboolean result = FALSE;
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
2010-11-12 12:18:58 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
return result;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_functions (GdkWindow *window,
|
|
|
|
GdkWMFunction functions)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2010-11-15 19:08:18 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2010-11-15 19:08:18 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2014-06-22 13:26:01 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_end_paint (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
impl->dirty = TRUE;
|
|
|
|
}
|
2010-11-12 12:18:58 +00:00
|
|
|
|
2011-04-15 14:31:56 +00:00
|
|
|
typedef struct _MoveResizeData MoveResizeData;
|
|
|
|
|
|
|
|
struct _MoveResizeData
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
|
|
GdkWindow *moveresize_window;
|
|
|
|
GdkWindow *moveresize_emulation_window;
|
|
|
|
gboolean is_resize;
|
|
|
|
GdkWindowEdge resize_edge;
|
|
|
|
gint moveresize_button;
|
|
|
|
gint moveresize_x;
|
|
|
|
gint moveresize_y;
|
|
|
|
gint moveresize_orig_x;
|
|
|
|
gint moveresize_orig_y;
|
|
|
|
gint moveresize_orig_width;
|
|
|
|
gint moveresize_orig_height;
|
|
|
|
long moveresize_process_time;
|
2013-03-28 19:03:13 +00:00
|
|
|
GdkWindowHints moveresize_geom_mask;
|
|
|
|
GdkGeometry moveresize_geometry;
|
2011-04-15 14:31:56 +00:00
|
|
|
BroadwayInputMsg *moveresize_pending_event;
|
|
|
|
};
|
|
|
|
|
|
|
|
static MoveResizeData *
|
|
|
|
get_move_resize_data (GdkDisplay *display,
|
|
|
|
gboolean create)
|
|
|
|
{
|
2013-03-28 16:38:44 +00:00
|
|
|
GdkBroadwayDisplay *broadway_display;
|
2011-04-15 14:31:56 +00:00
|
|
|
MoveResizeData *mv_resize;
|
|
|
|
|
2013-03-28 16:38:44 +00:00
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
2011-04-15 14:31:56 +00:00
|
|
|
|
2013-03-28 16:38:44 +00:00
|
|
|
mv_resize = broadway_display->move_resize_data;
|
2011-04-15 14:31:56 +00:00
|
|
|
|
|
|
|
if (!mv_resize && create)
|
|
|
|
{
|
|
|
|
mv_resize = g_new0 (MoveResizeData, 1);
|
|
|
|
mv_resize->display = display;
|
|
|
|
|
2013-03-28 16:38:44 +00:00
|
|
|
broadway_display->move_resize_data = mv_resize;
|
2011-04-15 14:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return mv_resize;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_pos (MoveResizeData *mv_resize,
|
|
|
|
gint new_root_x,
|
|
|
|
gint new_root_y)
|
|
|
|
{
|
|
|
|
gint dx, dy;
|
|
|
|
|
|
|
|
dx = new_root_x - mv_resize->moveresize_x;
|
|
|
|
dy = new_root_y - mv_resize->moveresize_y;
|
|
|
|
|
|
|
|
if (mv_resize->is_resize)
|
|
|
|
{
|
|
|
|
gint x, y, w, h;
|
|
|
|
|
|
|
|
x = mv_resize->moveresize_orig_x;
|
|
|
|
y = mv_resize->moveresize_orig_y;
|
|
|
|
|
|
|
|
w = mv_resize->moveresize_orig_width;
|
|
|
|
h = mv_resize->moveresize_orig_height;
|
|
|
|
|
|
|
|
switch (mv_resize->resize_edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
x += dx;
|
|
|
|
y += dy;
|
|
|
|
w -= dx;
|
|
|
|
h -= dy;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
y += dy;
|
|
|
|
h -= dy;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
y += dy;
|
|
|
|
h -= dy;
|
|
|
|
w += dx;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
h += dy;
|
|
|
|
x += dx;
|
|
|
|
w -= dx;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
w += dx;
|
|
|
|
h += dy;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
h += dy;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
w += dx;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
x += dx;
|
|
|
|
w -= dx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = MAX (x, 0);
|
|
|
|
y = MAX (y, 0);
|
|
|
|
w = MAX (w, 1);
|
|
|
|
h = MAX (h, 1);
|
|
|
|
|
2013-03-28 19:03:13 +00:00
|
|
|
if (mv_resize->moveresize_geom_mask)
|
|
|
|
{
|
|
|
|
gdk_window_constrain_size (&mv_resize->moveresize_geometry,
|
|
|
|
mv_resize->moveresize_geom_mask,
|
|
|
|
w, h, &w, &h);
|
|
|
|
}
|
|
|
|
|
2011-04-15 14:31:56 +00:00
|
|
|
gdk_window_move_resize (mv_resize->moveresize_window, x, y, w, h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint x, y;
|
|
|
|
|
|
|
|
x = mv_resize->moveresize_orig_x + dx;
|
|
|
|
y = mv_resize->moveresize_orig_y + dy;
|
|
|
|
|
|
|
|
gdk_window_move (mv_resize->moveresize_window, x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
finish_drag (MoveResizeData *mv_resize)
|
|
|
|
{
|
|
|
|
gdk_window_destroy (mv_resize->moveresize_emulation_window);
|
|
|
|
mv_resize->moveresize_emulation_window = NULL;
|
|
|
|
g_object_unref (mv_resize->moveresize_window);
|
|
|
|
mv_resize->moveresize_window = NULL;
|
2014-07-14 15:02:13 +00:00
|
|
|
g_clear_pointer (&mv_resize->moveresize_pending_event, g_free);
|
2011-04-15 14:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
moveresize_lookahead (GdkDisplay *display,
|
|
|
|
MoveResizeData *mv_resize,
|
|
|
|
BroadwayInputMsg *event)
|
|
|
|
{
|
|
|
|
GdkBroadwayDisplay *broadway_display;
|
|
|
|
|
|
|
|
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
|
|
|
|
2012-12-19 11:37:02 +00:00
|
|
|
return !_gdk_broadway_server_lookahead_event (broadway_display->server, "mb");
|
2011-04-15 14:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gdk_broadway_moveresize_handle_event (GdkDisplay *display,
|
|
|
|
BroadwayInputMsg *event)
|
|
|
|
{
|
|
|
|
guint button_mask = 0;
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
|
|
|
|
|
|
|
if (!mv_resize || !mv_resize->moveresize_window)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1);
|
|
|
|
|
|
|
|
switch (event->base.type)
|
|
|
|
{
|
2013-11-12 15:44:30 +00:00
|
|
|
case BROADWAY_EVENT_TOUCH:
|
|
|
|
if (event->touch.touch_type == 2) /* END */
|
|
|
|
{
|
|
|
|
update_pos (mv_resize,
|
|
|
|
event->touch.root_x,
|
|
|
|
event->touch.root_y);
|
|
|
|
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
}
|
|
|
|
else if (event->touch.touch_type == 1) /* UPDATE */
|
|
|
|
{
|
|
|
|
if (mv_resize->moveresize_window->resize_count > 0)
|
|
|
|
{
|
|
|
|
if (mv_resize->moveresize_pending_event)
|
|
|
|
*mv_resize->moveresize_pending_event = *event;
|
|
|
|
else
|
|
|
|
mv_resize->moveresize_pending_event =
|
|
|
|
g_memdup (event, sizeof (BroadwayInputMsg));
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
update_pos (mv_resize,
|
|
|
|
event->touch.root_x,
|
|
|
|
event->touch.root_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2013-03-28 16:38:44 +00:00
|
|
|
case BROADWAY_EVENT_POINTER_MOVE:
|
2011-04-15 14:31:56 +00:00
|
|
|
if (mv_resize->moveresize_window->resize_count > 0)
|
|
|
|
{
|
|
|
|
if (mv_resize->moveresize_pending_event)
|
|
|
|
*mv_resize->moveresize_pending_event = *event;
|
|
|
|
else
|
|
|
|
mv_resize->moveresize_pending_event =
|
|
|
|
g_memdup (event, sizeof (BroadwayInputMsg));
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!moveresize_lookahead (display, mv_resize, event))
|
|
|
|
break;
|
|
|
|
|
|
|
|
update_pos (mv_resize,
|
|
|
|
event->pointer.root_x,
|
|
|
|
event->pointer.root_y);
|
|
|
|
|
|
|
|
/* This should never be triggered in normal cases, but in the
|
|
|
|
* case where the drag started without an implicit grab being
|
|
|
|
* in effect, we could miss the release if it occurs before
|
|
|
|
* we grab the pointer; this ensures that we will never
|
|
|
|
* get a permanently stuck grab.
|
|
|
|
*/
|
|
|
|
if ((event->pointer.state & button_mask) == 0)
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
break;
|
|
|
|
|
2013-03-28 16:38:44 +00:00
|
|
|
case BROADWAY_EVENT_BUTTON_RELEASE:
|
2011-04-15 14:31:56 +00:00
|
|
|
update_pos (mv_resize,
|
|
|
|
event->pointer.root_x,
|
|
|
|
event->pointer.root_y);
|
|
|
|
|
|
|
|
if (event->button.button == mv_resize->moveresize_button)
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gdk_broadway_moveresize_configure_done (GdkDisplay *display,
|
|
|
|
GdkWindow *window)
|
|
|
|
{
|
|
|
|
BroadwayInputMsg *tmp_event;
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
|
|
|
|
|
|
|
if (!mv_resize || window != mv_resize->moveresize_window)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (mv_resize->moveresize_pending_event)
|
|
|
|
{
|
|
|
|
tmp_event = mv_resize->moveresize_pending_event;
|
|
|
|
mv_resize->moveresize_pending_event = NULL;
|
|
|
|
_gdk_broadway_moveresize_handle_event (display, tmp_event);
|
|
|
|
g_free (tmp_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
create_moveresize_window (MoveResizeData *mv_resize,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
GdkGrabStatus status;
|
2016-10-24 08:13:14 +00:00
|
|
|
GdkSeat *seat;
|
|
|
|
GdkDevice *pointer;
|
2011-04-15 14:31:56 +00:00
|
|
|
|
|
|
|
g_assert (mv_resize->moveresize_emulation_window == NULL);
|
|
|
|
|
2016-11-07 00:03:17 +00:00
|
|
|
mv_resize->moveresize_emulation_window = gdk_window_new_temp (mv_resize->display);
|
2011-04-15 14:31:56 +00:00
|
|
|
|
|
|
|
gdk_window_show (mv_resize->moveresize_emulation_window);
|
|
|
|
|
2016-10-24 08:13:14 +00:00
|
|
|
seat = gdk_display_get_default_seat (mv_resize->display);
|
|
|
|
pointer = gdk_seat_get_pointer (seat);
|
|
|
|
|
2013-04-01 13:38:19 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2016-10-24 08:13:14 +00:00
|
|
|
status = gdk_device_grab (pointer,
|
|
|
|
mv_resize->moveresize_emulation_window,
|
|
|
|
GDK_OWNERSHIP_APPLICATION,
|
2011-04-15 14:31:56 +00:00
|
|
|
FALSE,
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_POINTER_MOTION_MASK,
|
|
|
|
NULL,
|
|
|
|
timestamp);
|
2013-04-01 13:38:19 +00:00
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2011-04-15 14:31:56 +00:00
|
|
|
|
|
|
|
if (status != GDK_GRAB_SUCCESS)
|
|
|
|
{
|
|
|
|
/* If this fails, some other client has grabbed the window
|
|
|
|
* already.
|
|
|
|
*/
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
}
|
|
|
|
|
|
|
|
mv_resize->moveresize_process_time = 0;
|
|
|
|
}
|
|
|
|
|
2013-03-28 19:03:13 +00:00
|
|
|
static void
|
|
|
|
calculate_unmoving_origin (MoveResizeData *mv_resize)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
gint width, height;
|
|
|
|
|
|
|
|
if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY &&
|
|
|
|
mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC)
|
|
|
|
{
|
|
|
|
gdk_window_get_origin (mv_resize->moveresize_window,
|
|
|
|
&mv_resize->moveresize_orig_x,
|
|
|
|
&mv_resize->moveresize_orig_y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_window_get_frame_extents (mv_resize->moveresize_window, &rect);
|
|
|
|
gdk_window_get_geometry (mv_resize->moveresize_window,
|
|
|
|
NULL, NULL, &width, &height);
|
|
|
|
|
|
|
|
switch (mv_resize->moveresize_geometry.win_gravity)
|
|
|
|
{
|
|
|
|
case GDK_GRAVITY_NORTH_WEST:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_NORTH:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_NORTH_EAST:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x + rect.width - width;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_WEST:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x + rect.width - width;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_SOUTH_WEST:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y + rect.height - height;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y + rect.height - height;
|
|
|
|
break;
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x + rect.width - width;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y + rect.height - height;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mv_resize->moveresize_orig_x = rect.x;
|
|
|
|
mv_resize->moveresize_orig_y = rect.y;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_begin_resize_drag (GdkWindow *window,
|
2011-03-14 10:21:37 +00:00
|
|
|
GdkWindowEdge edge,
|
2011-11-05 05:12:07 +00:00
|
|
|
GdkDevice *device,
|
2011-03-14 10:21:37 +00:00
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-04-15 14:31:56 +00:00
|
|
|
MoveResizeData *mv_resize;
|
2013-03-28 19:03:13 +00:00
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
2011-04-15 14:31:56 +00:00
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
|
|
|
return;
|
|
|
|
|
2015-06-26 11:49:23 +00:00
|
|
|
if (impl->maximized)
|
|
|
|
return;
|
|
|
|
|
2013-04-19 19:50:38 +00:00
|
|
|
mv_resize = get_move_resize_data (gdk_window_get_display (window), TRUE);
|
2011-04-15 14:31:56 +00:00
|
|
|
|
|
|
|
mv_resize->is_resize = TRUE;
|
|
|
|
mv_resize->moveresize_button = button;
|
|
|
|
mv_resize->resize_edge = edge;
|
|
|
|
mv_resize->moveresize_x = root_x;
|
|
|
|
mv_resize->moveresize_y = root_y;
|
|
|
|
mv_resize->moveresize_window = g_object_ref (window);
|
|
|
|
|
|
|
|
mv_resize->moveresize_orig_width = gdk_window_get_width (window);
|
|
|
|
mv_resize->moveresize_orig_height = gdk_window_get_height (window);
|
|
|
|
|
2013-03-28 19:03:13 +00:00
|
|
|
mv_resize->moveresize_geom_mask = impl->geometry_hints_mask;
|
|
|
|
mv_resize->moveresize_geometry = impl->geometry_hints;
|
|
|
|
|
|
|
|
calculate_unmoving_origin (mv_resize);
|
|
|
|
|
2011-04-15 14:31:56 +00:00
|
|
|
create_moveresize_window (mv_resize, timestamp);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_begin_move_drag (GdkWindow *window,
|
2011-11-05 05:12:07 +00:00
|
|
|
GdkDevice *device,
|
2011-01-06 22:36:44 +00:00
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2013-11-06 12:28:12 +00:00
|
|
|
MoveResizeData *mv_resize;
|
|
|
|
GdkWindowImplBroadway *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
2013-11-06 12:28:12 +00:00
|
|
|
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
2010-11-12 12:18:58 +00:00
|
|
|
return;
|
|
|
|
|
2015-06-26 11:49:23 +00:00
|
|
|
if (impl->maximized)
|
|
|
|
return;
|
|
|
|
|
2013-11-06 12:28:12 +00:00
|
|
|
mv_resize = get_move_resize_data (gdk_window_get_display (window), TRUE);
|
|
|
|
|
|
|
|
mv_resize->is_resize = FALSE;
|
|
|
|
mv_resize->moveresize_button = button;
|
|
|
|
mv_resize->moveresize_x = root_x;
|
|
|
|
mv_resize->moveresize_y = root_y;
|
|
|
|
mv_resize->moveresize_window = g_object_ref (window);
|
|
|
|
|
|
|
|
mv_resize->moveresize_orig_width = gdk_window_get_width (window);
|
|
|
|
mv_resize->moveresize_orig_height = gdk_window_get_height (window);
|
|
|
|
|
|
|
|
mv_resize->moveresize_geom_mask = impl->geometry_hints_mask;
|
|
|
|
mv_resize->moveresize_geometry = impl->geometry_hints;
|
|
|
|
|
|
|
|
calculate_unmoving_origin (mv_resize);
|
|
|
|
|
|
|
|
create_moveresize_window (mv_resize, timestamp);
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_broadway_window_beep (GdkWindow *window)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
2011-01-06 22:36:44 +00:00
|
|
|
return FALSE;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 22:36:44 +00:00
|
|
|
static void
|
|
|
|
gdk_broadway_window_set_opacity (GdkWindow *window,
|
|
|
|
gdouble opacity)
|
2010-11-12 12:18:58 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
!WINDOW_IS_TOPLEVEL (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (opacity < 0)
|
|
|
|
opacity = 0;
|
|
|
|
else if (opacity > 1)
|
|
|
|
opacity = 1;
|
|
|
|
}
|
|
|
|
|
2011-04-07 18:18:13 +00:00
|
|
|
guint32
|
|
|
|
gdk_broadway_get_last_seen_time (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
|
|
display = gdk_window_get_display (window);
|
2012-12-19 11:37:02 +00:00
|
|
|
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
|
2011-04-07 18:18:13 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:18:58 +00:00
|
|
|
static void
|
2010-12-04 21:28:31 +00:00
|
|
|
gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gdk_window_impl_broadway_finalize;
|
|
|
|
|
|
|
|
impl_class->ref_cairo_surface = gdk_window_broadway_ref_cairo_surface;
|
|
|
|
impl_class->show = gdk_window_broadway_show;
|
|
|
|
impl_class->hide = gdk_window_broadway_hide;
|
|
|
|
impl_class->withdraw = gdk_window_broadway_withdraw;
|
|
|
|
impl_class->set_events = gdk_window_broadway_set_events;
|
|
|
|
impl_class->get_events = gdk_window_broadway_get_events;
|
|
|
|
impl_class->raise = gdk_window_broadway_raise;
|
|
|
|
impl_class->lower = gdk_window_broadway_lower;
|
|
|
|
impl_class->restack_toplevel = gdk_window_broadway_restack_toplevel;
|
|
|
|
impl_class->move_resize = gdk_window_broadway_move_resize;
|
|
|
|
impl_class->set_device_cursor = gdk_window_broadway_set_device_cursor;
|
|
|
|
impl_class->get_geometry = gdk_window_broadway_get_geometry;
|
|
|
|
impl_class->get_root_coords = gdk_window_broadway_get_root_coords;
|
|
|
|
impl_class->get_device_state = gdk_window_broadway_get_device_state;
|
|
|
|
impl_class->shape_combine_region = gdk_window_broadway_shape_combine_region;
|
|
|
|
impl_class->input_shape_combine_region = gdk_window_broadway_input_shape_combine_region;
|
|
|
|
impl_class->destroy = _gdk_broadway_window_destroy;
|
2014-06-22 13:26:01 +00:00
|
|
|
impl_class->end_paint = gdk_broadway_window_end_paint;
|
2011-01-06 22:36:44 +00:00
|
|
|
impl_class->beep = gdk_broadway_window_beep;
|
|
|
|
|
|
|
|
impl_class->focus = gdk_broadway_window_focus;
|
|
|
|
impl_class->set_type_hint = gdk_broadway_window_set_type_hint;
|
|
|
|
impl_class->get_type_hint = gdk_broadway_window_get_type_hint;
|
|
|
|
impl_class->set_modal_hint = gdk_broadway_window_set_modal_hint;
|
|
|
|
impl_class->set_skip_taskbar_hint = gdk_broadway_window_set_skip_taskbar_hint;
|
|
|
|
impl_class->set_skip_pager_hint = gdk_broadway_window_set_skip_pager_hint;
|
|
|
|
impl_class->set_urgency_hint = gdk_broadway_window_set_urgency_hint;
|
|
|
|
impl_class->set_geometry_hints = gdk_broadway_window_set_geometry_hints;
|
|
|
|
impl_class->set_title = gdk_broadway_window_set_title;
|
|
|
|
impl_class->set_role = gdk_broadway_window_set_role;
|
|
|
|
impl_class->set_startup_id = gdk_broadway_window_set_startup_id;
|
|
|
|
impl_class->set_transient_for = gdk_broadway_window_set_transient_for;
|
|
|
|
impl_class->get_frame_extents = gdk_broadway_window_get_frame_extents;
|
|
|
|
impl_class->set_accept_focus = gdk_broadway_window_set_accept_focus;
|
|
|
|
impl_class->set_focus_on_map = gdk_broadway_window_set_focus_on_map;
|
|
|
|
impl_class->set_icon_list = gdk_broadway_window_set_icon_list;
|
|
|
|
impl_class->set_icon_name = gdk_broadway_window_set_icon_name;
|
|
|
|
impl_class->iconify = gdk_broadway_window_iconify;
|
|
|
|
impl_class->deiconify = gdk_broadway_window_deiconify;
|
|
|
|
impl_class->stick = gdk_broadway_window_stick;
|
|
|
|
impl_class->unstick = gdk_broadway_window_unstick;
|
|
|
|
impl_class->maximize = gdk_broadway_window_maximize;
|
|
|
|
impl_class->unmaximize = gdk_broadway_window_unmaximize;
|
|
|
|
impl_class->fullscreen = gdk_broadway_window_fullscreen;
|
|
|
|
impl_class->unfullscreen = gdk_broadway_window_unfullscreen;
|
|
|
|
impl_class->set_keep_above = gdk_broadway_window_set_keep_above;
|
|
|
|
impl_class->set_keep_below = gdk_broadway_window_set_keep_below;
|
|
|
|
impl_class->get_group = gdk_broadway_window_get_group;
|
|
|
|
impl_class->set_group = gdk_broadway_window_set_group;
|
|
|
|
impl_class->set_decorations = gdk_broadway_window_set_decorations;
|
|
|
|
impl_class->get_decorations = gdk_broadway_window_get_decorations;
|
|
|
|
impl_class->set_functions = gdk_broadway_window_set_functions;
|
|
|
|
impl_class->begin_resize_drag = gdk_broadway_window_begin_resize_drag;
|
|
|
|
impl_class->begin_move_drag = gdk_broadway_window_begin_move_drag;
|
|
|
|
impl_class->set_opacity = gdk_broadway_window_set_opacity;
|
|
|
|
impl_class->destroy_notify = gdk_broadway_window_destroy_notify;
|
|
|
|
impl_class->register_dnd = _gdk_broadway_window_register_dnd;
|
|
|
|
impl_class->drag_begin = _gdk_broadway_window_drag_begin;
|
|
|
|
impl_class->get_property = _gdk_broadway_window_get_property;
|
|
|
|
impl_class->change_property = _gdk_broadway_window_change_property;
|
|
|
|
impl_class->delete_property = _gdk_broadway_window_delete_property;
|
2011-02-11 14:59:50 +00:00
|
|
|
impl_class->get_drag_protocol = _gdk_broadway_window_get_drag_protocol;
|
2010-11-12 12:18:58 +00:00
|
|
|
}
|