gtk2/gdk/broadway/gdkwindow-broadway.c

1422 lines
34 KiB
C
Raw Normal View History

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
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* 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
#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>
#include <netinet/in.h>
#include <unistd.h>
/* Forward declarations */
static void gdk_window_broadway_set_background (GdkWindow *window,
2010-11-12 12:18:58 +00:00
cairo_pattern_t *pattern);
static void gdk_window_impl_broadway_finalize (GObject *object);
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) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
#define WINDOW_IS_TOPLEVEL(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
G_DEFINE_TYPE (GdkWindowImplBroadway,
gdk_window_impl_broadway,
GDK_TYPE_WINDOW_IMPL)
2010-11-12 12:18:58 +00:00
GType
_gdk_window_impl_get_type (void)
{
return gdk_window_impl_broadway_get_type ();
2010-11-12 12:18:58 +00:00
}
static void
diff_surfaces (cairo_surface_t *surface,
cairo_surface_t *old_surface)
2010-11-15 19:08:18 +00:00
{
guint8 *data, *old_data;
guint32 *line, *old_line;
int w, h, stride, old_stride;
int x, y;
2010-11-15 20:51:32 +00:00
data = cairo_image_surface_get_data (surface);
old_data = cairo_image_surface_get_data (old_surface);
w = cairo_image_surface_get_width (surface);
h = cairo_image_surface_get_height (surface);
stride = cairo_image_surface_get_stride (surface);
old_stride = cairo_image_surface_get_stride (old_surface);
for (y = 0; y < h; y++)
{
line = (guint32 *)data;
old_line = (guint32 *)old_data;
for (x = 0; x < w; x++)
{
if ((*line & 0xffffff) == (*old_line & 0xffffff))
*old_line = 0;
else
*old_line = *line | 0xff000000;
line ++;
old_line ++;
}
data += stride;
old_data += old_stride;
}
}
static guint dirty_flush_id = 0;
static void
window_data_send (BroadwayOutput *output, GdkWindowImplBroadway *impl)
{
cairo_t *cr;
if (impl->surface == NULL)
return;
if (impl->last_synced)
{
diff_surfaces (impl->surface,
impl->last_surface);
broadway_output_put_rgba (output, impl->id, 0, 0,
cairo_image_surface_get_width (impl->last_surface),
cairo_image_surface_get_height (impl->last_surface),
cairo_image_surface_get_stride (impl->last_surface),
cairo_image_surface_get_data (impl->last_surface));
}
else
{
impl->last_synced = TRUE;
broadway_output_put_rgb (output, impl->id, 0, 0,
cairo_image_surface_get_width (impl->surface),
cairo_image_surface_get_height (impl->surface),
cairo_image_surface_get_stride (impl->surface),
cairo_image_surface_get_data (impl->surface));
}
cr = cairo_create (impl->last_surface);
cairo_set_source_surface (cr, impl->surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
}
static gboolean
dirty_flush_idle (gpointer data)
{
GList *l;
GdkDisplayBroadway *display;
BroadwayOutput *output;
dirty_flush_id = 0;
display = GDK_DISPLAY_BROADWAY (gdk_display_get_default ());
output = display->output;
if (output == NULL)
return FALSE;
2010-11-24 18:41:19 +00:00
for (l = display->toplevels; l != NULL; l = l->next)
{
GdkWindowImplBroadway *impl = l->data;
if (impl->dirty)
{
impl->dirty = FALSE;
window_data_send (display->output, impl);
}
}
2010-11-24 21:12:50 +00:00
if (!broadway_output_flush (display->output))
{
broadway_output_free (display->output);
display->output = NULL;
}
return FALSE;
}
static void
queue_dirty_flush (GdkDisplayBroadway *display)
{
if (dirty_flush_id == 0 && display->output != NULL)
dirty_flush_id = gdk_threads_add_idle (dirty_flush_idle, NULL);
}
void
_gdk_broadway_resync_windows (void)
{
GdkDisplayBroadway *display;
GList *l;
dirty_flush_id = 0;
display = GDK_DISPLAY_BROADWAY (gdk_display_get_default ());
2010-11-24 18:41:19 +00:00
for (l = display->toplevels; l != NULL; l = l->next)
{
GdkWindowImplBroadway *impl = l->data;
GdkWindow *window;
window = impl->wrapper;
2010-11-19 20:55:13 +00:00
if (impl->id == 0)
continue; /* Skip root */
impl->dirty = FALSE;
impl->last_synced = FALSE;
broadway_output_new_surface (display->output,
impl->id,
window->x,
window->y,
window->width,
window->height);
if (GDK_WINDOW_IS_MAPPED (window))
{
broadway_output_show_surface (display->output, impl->id);
window_data_send (display->output, impl);
}
}
broadway_output_flush (display->output);
}
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,
(GDestroyNotify) gdk_cursor_unref);
}
static void
gdk_window_impl_broadway_finalize (GObject *object)
2010-11-12 12:18:58 +00:00
{
GdkWindow *wrapper;
GdkWindowImplBroadway *impl;
2010-11-20 21:38:34 +00:00
GdkDisplayBroadway *display_broadway;
2010-11-15 19:08:18 +00:00
g_return_if_fail (GDK_IS_WINDOW_IMPL_BROADWAY (object));
2010-11-12 12:18:58 +00:00
impl = GDK_WINDOW_IMPL_BROADWAY (object);
2010-11-12 12:18:58 +00:00
wrapper = impl->wrapper;
2010-11-12 12:18:58 +00:00
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (impl->wrapper));
if (display_broadway->mouse_in_toplevel == GDK_WINDOW (wrapper))
{
/* TODO: Send leave + enter event, update cursors, etc */
display_broadway->mouse_in_toplevel = NULL;
}
g_hash_table_remove (display_broadway->id_ht, GINT_TO_POINTER(impl->id));
2010-11-20 21:38:34 +00:00
if (impl->cursor)
gdk_cursor_unref (impl->cursor);
2010-11-12 12:18:58 +00:00
g_hash_table_destroy (impl->device_cursor);
2010-11-12 12:18:58 +00:00
display_broadway->toplevels = g_list_remove (display_broadway->toplevels, impl);
G_OBJECT_CLASS (gdk_window_impl_broadway_parent_class)->finalize (object);
2010-11-12 12:18:58 +00:00
}
void
_gdk_windowing_window_init (GdkScreen * screen)
{
GdkWindow *window;
GdkWindowImplBroadway *impl;
GdkScreenBroadway *screen_broadway;
2010-11-12 12:18:58 +00:00
screen_broadway = GDK_SCREEN_BROADWAY (screen);
2010-11-12 12:18:58 +00:00
g_assert (screen_broadway->root_window == NULL);
2010-11-12 12:18:58 +00:00
screen_broadway->root_window = g_object_new (GDK_TYPE_WINDOW, NULL);
2010-11-12 12:18:58 +00:00
window = screen_broadway->root_window;
window->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
window->impl_window = window;
window->visual = gdk_screen_get_system_visual (screen);
2010-11-12 12:18:58 +00:00
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
2010-11-15 19:08:18 +00:00
impl->screen = screen;
impl->wrapper = window;
2010-11-15 19:08:18 +00:00
window->window_type = GDK_WINDOW_ROOT;
window->depth = 24;
2010-11-12 12:18:58 +00:00
window->x = 0;
window->y = 0;
window->abs_x = 0;
window->abs_y = 0;
window->width = gdk_screen_get_width (screen);
window->height = gdk_screen_get_height (screen);
window->viewable = TRUE;
2010-11-12 12:18:58 +00:00
_gdk_window_update_size (screen_broadway->root_window);
2010-11-12 12:18:58 +00:00
}
void
_gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask)
{
GdkWindowImplBroadway *impl;
GdkScreenBroadway *screen_broadway;
GdkDisplayBroadway *display_broadway;
static int current_id = 1; /* 0 is the root window */
2010-11-15 19:08:18 +00:00
screen_broadway = GDK_SCREEN_BROADWAY (screen);
display_broadway = GDK_DISPLAY_BROADWAY (GDK_SCREEN_DISPLAY (screen));
2010-11-15 19:08:18 +00:00
2010-11-12 12:18:58 +00:00
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
window->impl = (GdkWindowImpl *)impl;
impl->id = current_id++;
2010-11-21 18:53:19 +00:00
g_hash_table_insert (display_broadway->id_ht, GINT_TO_POINTER(impl->id), window);
impl->wrapper = window;
2010-11-12 12:18:58 +00:00
impl->screen = screen;
2010-11-12 12:18:58 +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-24 18:41:19 +00:00
display_broadway->toplevels = g_list_prepend (display_broadway->toplevels, impl);
/* Instead of window manager placement we have this mini hack
so that the main/first window is not covered in the demos. */
if (impl->id > 1 && window->window_type == GDK_WINDOW_TOPLEVEL)
{
window->x = 100;
window->y = 20;
}
if (display_broadway->output)
broadway_output_new_surface (display_broadway->output,
impl->id,
window->x,
window->y,
window->width,
window->height);
2010-11-12 12:18:58 +00:00
}
GdkWindow *
gdk_window_foreign_new_for_display (GdkDisplay *display,
GdkNativeWindow anid)
{
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
GdkWindow *
gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
{
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
GdkWindow *
gdk_window_lookup (GdkNativeWindow anid)
{
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
static void
resize_surface (GdkWindow *window)
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
cairo_surface_t *old, *last_old;
if (impl->surface)
{
old = impl->surface;
last_old = impl->last_surface;
impl->surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
impl->last_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
{ cairo_t *cr;
cr = cairo_create (impl->surface);
cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
cairo_rectangle (cr, 0, 0, 1000, 1000);
cairo_fill (cr);
cairo_destroy (cr);
}
cairo_surface_destroy (old);
cairo_surface_destroy (last_old);
}
if (impl->ref_surface)
{
cairo_surface_set_user_data (impl->ref_surface, &gdk_broadway_cairo_key,
NULL, NULL);
impl->ref_surface = NULL;
}
}
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);
cairo_t *cr;
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)
{
impl->surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, w, h);
impl->last_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, w, h);
cr = cairo_create (impl->surface);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
cairo_destroy (cr);
cr = cairo_create (impl->last_surface);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
cairo_destroy (cr);
}
/* 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
_gdk_broadway_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
2010-11-12 12:18:58 +00:00
{
GdkWindowImplBroadway *impl;
GdkDisplayBroadway *display_broadway;
2010-11-15 19:08:18 +00:00
2010-11-12 12:18:58 +00:00
g_return_if_fail (GDK_IS_WINDOW (window));
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
2010-11-12 12:18:58 +00:00
_gdk_selection_window_destroyed (window);
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;
cairo_surface_destroy (impl->last_surface);
impl->last_surface = NULL;
}
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window));
if (display_broadway->output)
broadway_output_destroy_surface (display_broadway->output,
impl->id);
2010-11-12 12:18:58 +00:00
}
static cairo_surface_t *
gdk_window_broadway_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
gint height)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
/* Image surfaces cannot be resized */
cairo_surface_destroy (surface);
2010-11-12 12:18:58 +00:00
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
void
_gdk_windowing_window_destroy_foreign (GdkWindow *window)
{
}
/* This function is called when the XWindow is really gone.
*/
void
gdk_window_destroy_notify (GdkWindow *window)
{
GdkWindowImplBroadway *window_impl;
2010-11-12 12:18:58 +00:00
window_impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
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
gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped)
2010-11-12 12:18:58 +00:00
{
GdkWindowImplBroadway *impl;
GdkDisplayBroadway *display_broadway;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
if (window->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE);
if (window->parent && window->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE);
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window));
if (display_broadway->output)
{
broadway_output_show_surface (display_broadway->output, impl->id);
queue_dirty_flush (display_broadway);
}
2010-11-12 12:18:58 +00:00
}
static void
gdk_window_broadway_hide (GdkWindow *window)
2010-11-12 12:18:58 +00:00
{
GdkWindowImplBroadway *impl;
GdkDisplayBroadway *display_broadway;
2010-11-12 12:18:58 +00:00
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
2010-11-12 12:18:58 +00:00
if (window->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE);
if (window->parent && window->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE);
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window));
if (display_broadway->output)
{
broadway_output_hide_surface (display_broadway->output, impl->id);
queue_dirty_flush (display_broadway);
}
if (display_broadway->mouse_in_toplevel == window)
{
/* TODO: Send leave + enter event, update cursors, etc */
display_broadway->mouse_in_toplevel = NULL;
}
2010-11-12 12:18:58 +00:00
_gdk_window_clear_update_area (window);
}
static void
gdk_window_broadway_withdraw (GdkWindow *window)
2010-11-12 12:18:58 +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
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
2010-11-21 19:46:50 +00:00
GdkDisplayBroadway *display_broadway;
2010-11-23 11:52:10 +00:00
gboolean changed;
changed = FALSE;
2010-11-15 19:08:18 +00:00
2010-11-21 19:46:50 +00:00
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window));
if (with_move)
{
2010-11-23 11:52:10 +00:00
changed = TRUE;
window->x = x;
window->y = y;
2010-11-21 19:46:50 +00:00
if (display_broadway->output != NULL)
{
broadway_output_move_surface (display_broadway->output,
2010-11-21 19:46:50 +00:00
impl->id, x, y);
queue_dirty_flush (display_broadway);
}
}
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
if (width != window->width ||
height != window->height)
2010-11-23 11:52:10 +00:00
{
changed = TRUE;
/* Resize clears the content */
impl->dirty = TRUE;
impl->last_synced = FALSE;
broadway_output_resize_surface (display_broadway->output,
2010-11-23 11:52:10 +00:00
impl->id, width, height);
queue_dirty_flush (display_broadway);
window->width = width;
window->height = height;
resize_surface (window);
2010-11-23 11:52:10 +00:00
gdk_window_invalidate_rect (window, NULL, TRUE);
}
}
if (changed)
{
GdkEvent *event;
GList *node;
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);
event->configure.x = window->x;
event->configure.y = window->y;
event->configure.width = window->width;
event->configure.height = window->height;
2010-11-23 11:52:10 +00:00
gdk_event_set_device (event, GDK_DISPLAY_OBJECT (display_broadway)->core_pointer);
2010-11-12 12:18:58 +00:00
2010-11-23 11:52:10 +00:00
node = _gdk_event_queue_append (GDK_DISPLAY_OBJECT (display_broadway), event);
_gdk_windowing_got_event (GDK_DISPLAY_OBJECT (display_broadway), node, event, 0);
2010-11-12 12:18:58 +00:00
}
}
static gboolean
gdk_window_broadway_reparent (GdkWindow *window,
2010-11-12 12:18:58 +00:00
GdkWindow *new_parent,
gint x,
gint y)
{
return FALSE;
}
static void
gdk_window_broadway_raise (GdkWindow *window)
2010-11-12 12:18:58 +00:00
{
}
static void
gdk_window_broadway_restack_under (GdkWindow *window,
2010-11-12 12:18:58 +00:00
GList *native_siblings /* in requested order, first is bottom-most */)
{
}
static void
gdk_window_broadway_restack_toplevel (GdkWindow *window,
2010-11-12 12:18:58 +00:00
GdkWindow *sibling,
gboolean above)
{
}
static void
gdk_window_broadway_lower (GdkWindow *window)
2010-11-12 12:18:58 +00:00
{
}
void
gdk_window_focus (GdkWindow *window,
guint32 timestamp)
{
}
void
gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint)
{
}
GdkWindowTypeHint
gdk_window_get_type_hint (GdkWindow *window)
{
2010-11-15 19:08:18 +00:00
return GDK_WINDOW_TYPE_HINT_NORMAL;
2010-11-12 12:18:58 +00:00
}
void
gdk_window_set_modal_hint (GdkWindow *window,
gboolean modal)
{
}
void
gdk_window_set_skip_taskbar_hint (GdkWindow *window,
gboolean skips_taskbar)
{
}
void
gdk_window_set_skip_pager_hint (GdkWindow *window,
gboolean skips_pager)
{
}
void
gdk_window_set_urgency_hint (GdkWindow *window,
gboolean urgent)
{
}
2010-11-15 19:08:18 +00:00
void
2010-11-12 12:18:58 +00:00
gdk_window_set_geometry_hints (GdkWindow *window,
const GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
}
2010-11-15 19:08:18 +00:00
void
gdk_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
void
gdk_window_set_role (GdkWindow *window,
const gchar *role)
{
}
void
gdk_window_set_startup_id (GdkWindow *window,
const gchar *startup_id)
{
}
void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
}
static void
gdk_window_broadway_set_background (GdkWindow *window,
2010-11-12 12:18:58 +00:00
cairo_pattern_t *pattern)
{
2010-11-15 19:08:18 +00:00
return;
2010-11-12 12:18:58 +00:00
}
static void
gdk_window_broadway_set_device_cursor (GdkWindow *window,
2010-11-12 12:18:58 +00:00
GdkDevice *device,
GdkCursor *cursor)
{
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));
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
{
_gdk_broadway_cursor_update_theme (cursor);
2010-11-12 12:18:58 +00:00
g_hash_table_replace (impl->device_cursor,
device, gdk_cursor_ref (cursor));
}
if (!GDK_WINDOW_DESTROYED (window))
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
}
GdkCursor *
_gdk_broadway_window_get_cursor (GdkWindow *window)
2010-11-12 12:18:58 +00:00
{
GdkWindowImplBroadway *impl;
2010-11-15 19:08:18 +00:00
2010-11-12 12:18:58 +00:00
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
2010-11-15 19:08:18 +00:00
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
2010-11-12 12:18:58 +00:00
return impl->cursor;
}
static void
gdk_window_broadway_get_geometry (GdkWindow *window,
2010-11-12 12:18:58 +00:00
gint *x,
gint *y,
gint *width,
gint *height,
gint *depth)
{
}
static gint
gdk_window_broadway_get_root_coords (GdkWindow *window,
2010-11-12 12:18:58 +00:00
gint x,
gint y,
gint *root_x,
gint *root_y)
{
if (root_x)
2010-11-15 19:08:18 +00:00
*root_x = x;
2010-11-12 12:18:58 +00:00
if (root_y)
2010-11-15 19:08:18 +00:00
*root_y = y;
return 1;
2010-11-12 12:18:58 +00:00
}
void
gdk_window_get_root_origin (GdkWindow *window,
gint *x,
gint *y)
{
if (x)
2010-11-15 19:08:18 +00:00
*x = 0;
2010-11-12 12:18:58 +00:00
if (y)
2010-11-15 19:08:18 +00:00
*y = 0;
2010-11-12 12:18:58 +00:00
}
void
gdk_window_get_frame_extents (GdkWindow *window,
GdkRectangle *rect)
{
g_return_if_fail (rect != NULL);
2010-11-15 19:08:18 +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
}
void
_gdk_windowing_get_device_state (GdkDisplay *display,
GdkDevice *device,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask)
{
if (display->closed)
return;
2010-11-24 21:02:30 +00:00
*screen = gdk_display_get_default_screen (display);
*x = 0;
*y = 0;
*mask = 0;
2010-11-12 12:18:58 +00:00
}
static gboolean
gdk_window_broadway_get_device_state (GdkWindow *window,
GdkDevice *device,
gint *x,
gint *y,
GdkModifierType *mask)
{
*x = 0;
*y = 0;
*mask = 0;
2010-11-15 19:08:18 +00:00
return FALSE;
2010-11-12 12:18:58 +00:00
}
void
gdk_display_warp_pointer (GdkDisplay *display,
GdkScreen *screen,
gint x,
gint y)
{
GdkDevice *device;
g_return_if_fail (GDK_IS_DISPLAY (display));
g_return_if_fail (GDK_IS_SCREEN (screen));
device = display->core_pointer;
GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
}
void
gdk_display_warp_device (GdkDisplay *display,
GdkDevice *device,
GdkScreen *screen,
gint x,
gint y)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (display == gdk_device_get_display (device));
GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
}
GdkWindow*
_gdk_windowing_window_at_device_position (GdkDisplay *display,
GdkDevice *device,
gint *win_x,
gint *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkWindow *window;
GdkDisplayBroadway *display_broadway;
GdkScreen *screen;
display_broadway = GDK_DISPLAY_BROADWAY (display);
screen = gdk_display_get_screen (display, 0);
window = _gdk_window_find_child_at (gdk_screen_get_root_window (screen),
display_broadway->last_x,
display_broadway->last_y);
if (window != NULL)
{
*win_x = display_broadway->last_x - window->x;
*win_y = display_broadway->last_y - window->y;
2010-11-25 11:40:33 +00:00
if (mask)
*mask = 0;
}
return window;
2010-11-12 12:18:58 +00:00
}
static GdkEventMask
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
}
static void
gdk_window_broadway_set_events (GdkWindow *window,
2010-11-12 12:18:58 +00:00
GdkEventMask event_mask)
{
if (!GDK_WINDOW_DESTROYED (window))
{
}
}
static void
gdk_window_broadway_shape_combine_region (GdkWindow *window,
2010-11-12 12:18:58 +00:00
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
{
}
2010-11-15 19:08:18 +00:00
static void
gdk_window_broadway_input_shape_combine_region (GdkWindow *window,
2010-11-12 12:18:58 +00:00
const cairo_region_t *shape_region,
gint offset_x,
gint offset_y)
{
}
void
gdk_window_set_override_redirect (GdkWindow *window,
gboolean override_redirect)
{
}
void
gdk_window_set_accept_focus (GdkWindow *window,
gboolean accept_focus)
{
accept_focus = accept_focus != FALSE;
if (window->accept_focus != accept_focus)
2010-11-12 12:18:58 +00:00
{
window->accept_focus = accept_focus;
2010-11-12 12:18:58 +00:00
}
}
void
gdk_window_set_focus_on_map (GdkWindow *window,
gboolean focus_on_map)
{
focus_on_map = focus_on_map != FALSE;
if (window->focus_on_map != focus_on_map)
2010-11-12 12:18:58 +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
void
gdk_window_set_icon_list (GdkWindow *window,
GList *pixbufs)
{
}
2010-11-12 12:18:58 +00:00
void
2010-11-15 19:08:18 +00:00
gdk_window_set_icon_name (GdkWindow *window,
const gchar *name)
2010-11-12 12:18:58 +00:00
{
GdkDisplay *display;
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return;
2010-11-15 19:08:18 +00:00
display = gdk_window_get_display (window);
g_object_set_qdata (G_OBJECT (window), g_quark_from_static_string ("gdk-icon-name-set"),
GUINT_TO_POINTER (name != NULL));
2010-11-12 12:18:58 +00:00
}
void
2010-11-15 19:08:18 +00:00
gdk_window_iconify (GdkWindow *window)
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
void
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_window_maximize (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))
2010-11-12 12:18:58 +00:00
return;
}
2010-11-15 19:08:18 +00:00
void
gdk_window_unmaximize (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
void
gdk_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
2010-11-15 19:08:18 +00:00
void
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_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
}
2010-11-15 19:08:18 +00:00
GdkWindow *
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_window_set_group (GdkWindow *window,
GdkWindow *leader)
2010-11-12 12:18:58 +00:00
{
}
2010-11-15 19:08:18 +00:00
void
gdk_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
2010-11-12 12:18:58 +00:00
gboolean
2010-11-15 19:08:18 +00:00
gdk_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
}
2010-11-15 19:08:18 +00:00
void
gdk_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
}
2010-11-15 19:08:18 +00:00
cairo_region_t *
_gdk_windowing_window_get_shape (GdkWindow *window)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
2010-11-15 19:08:18 +00:00
cairo_region_t *
_gdk_windowing_window_get_input_shape (GdkWindow *window)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
2010-11-15 19:08:18 +00:00
static gboolean
gdk_window_broadway_set_static_gravities (GdkWindow *window,
2010-11-15 19:08:18 +00:00
gboolean use_static)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return TRUE;
2010-11-12 12:18:58 +00:00
}
void
gdk_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
gint button,
gint root_x,
gint root_y,
guint32 timestamp)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return;
}
void
gdk_window_begin_move_drag (GdkWindow *window,
gint button,
gint root_x,
gint root_y,
guint32 timestamp)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
}
void
gdk_window_enable_synchronized_configure (GdkWindow *window)
{
if (!GDK_IS_WINDOW_IMPL_BROADWAY (window->impl))
2010-11-12 12:18:58 +00:00
return;
}
void
gdk_window_configure_finished (GdkWindow *window)
{
if (!WINDOW_IS_TOPLEVEL (window))
return;
}
void
_gdk_windowing_window_beep (GdkWindow *window)
{
GdkDisplay *display;
g_return_if_fail (GDK_IS_WINDOW (window));
display = GDK_WINDOW_DISPLAY (window);
2010-11-15 19:08:18 +00:00
gdk_display_beep (display);
2010-11-12 12:18:58 +00:00
}
void
gdk_window_set_opacity (GdkWindow *window,
gdouble opacity)
{
GdkDisplay *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));
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
display = gdk_window_get_display (window);
if (opacity < 0)
opacity = 0;
else if (opacity > 1)
opacity = 1;
}
void
_gdk_windowing_window_set_composited (GdkWindow *window,
gboolean composited)
{
}
void
_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
cairo_region_t *region)
{
GdkWindowImplBroadway *impl;
2010-11-15 20:51:32 +00:00
2010-11-12 12:18:58 +00:00
_gdk_window_process_updates_recurse (window, region);
2010-11-15 20:51:32 +00:00
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
2010-11-15 20:51:32 +00:00
impl->dirty = TRUE;
queue_dirty_flush (GDK_DISPLAY_BROADWAY (gdk_window_get_display (window)));
2010-11-12 12:18:58 +00:00
}
void
_gdk_windowing_before_process_all_updates (void)
{
}
void
_gdk_windowing_after_process_all_updates (void)
{
}
2010-11-15 19:08:18 +00:00
gboolean
_gdk_broadway_window_queue_antiexpose (GdkWindow *window,
2010-11-15 19:08:18 +00:00
cairo_region_t *area)
{
return TRUE;
}
static void
copy_region (cairo_surface_t *surface,
cairo_region_t *area,
gint dx,
gint dy)
2010-11-15 19:08:18 +00:00
{
cairo_t *cr;
cr = cairo_create (surface);
gdk_cairo_region (cr, area);
cairo_clip (cr);
/* NB: This is a self-copy and Cairo doesn't support that yet.
* So we do a litle trick.
*/
cairo_push_group (cr);
cairo_set_source_surface (cr, surface, dx, dy);
cairo_paint (cr);
cairo_pop_group_to_source (cr);
cairo_paint (cr);
cairo_destroy (cr);
}
void
_gdk_broadway_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
GdkWindowImplBroadway *impl;
GdkDisplayBroadway *display_broadway;
int n_rects, i;
BroadwayRect *rects;
cairo_rectangle_int_t rect;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
if (impl->surface)
{
copy_region (impl->surface, area, dx, dy);
if (GDK_WINDOW_IMPL_BROADWAY (impl)->last_synced)
{
copy_region (impl->last_surface, area, dx, dy);
n_rects = cairo_region_num_rectangles (area);
rects = g_new (BroadwayRect, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (area, i, &rect);
rects[i].x = rect.x;
rects[i].y = rect.y;
rects[i].width = rect.width;
rects[i].height = rect.height;
}
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window));
broadway_output_copy_rectangles (display_broadway->output,
GDK_WINDOW_IMPL_BROADWAY (impl)->id,
rects, n_rects, dx, dy);
queue_dirty_flush (display_broadway);
g_free (rects);
}
}
2010-11-15 19:08:18 +00:00
}
2010-11-12 12:18:58 +00:00
static void
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_under = gdk_window_broadway_restack_under;
impl_class->restack_toplevel = gdk_window_broadway_restack_toplevel;
impl_class->move_resize = gdk_window_broadway_move_resize;
impl_class->set_background = gdk_window_broadway_set_background;
impl_class->reparent = gdk_window_broadway_reparent;
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->set_static_gravities = gdk_window_broadway_set_static_gravities;
impl_class->queue_antiexpose = _gdk_broadway_window_queue_antiexpose;
impl_class->translate = _gdk_broadway_window_translate;
impl_class->destroy = _gdk_broadway_window_destroy;
impl_class->resize_cairo_surface = gdk_window_broadway_resize_cairo_surface;
2010-11-12 12:18:58 +00:00
}