2008-07-01 22:57:50 +00:00
|
|
|
|
/* GDK - The GIMP Drawing Kit
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
1998-03-17 07:54:57 +00:00
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
|
/*
|
2019-04-06 16:36:51 +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/.
|
|
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
2010-05-14 15:23:33 +00:00
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2010-10-14 11:25:23 +00:00
|
|
|
|
#include <cairo-gobject.h>
|
|
|
|
|
|
2018-03-20 10:46:11 +00:00
|
|
|
|
#include "gdksurface.h"
|
2010-05-14 15:23:33 +00:00
|
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include "gdkrectangle.h"
|
2010-05-14 15:23:33 +00:00
|
|
|
|
#include "gdkinternals.h"
|
|
|
|
|
#include "gdkintl.h"
|
2010-12-16 03:09:35 +00:00
|
|
|
|
#include "gdkdisplayprivate.h"
|
2010-05-25 22:38:44 +00:00
|
|
|
|
#include "gdkdeviceprivate.h"
|
2018-03-28 22:07:52 +00:00
|
|
|
|
#include "gdkframeclockidleprivate.h"
|
2010-05-14 15:23:33 +00:00
|
|
|
|
#include "gdkmarshalers.h"
|
2014-10-09 08:45:44 +00:00
|
|
|
|
#include "gdkglcontextprivate.h"
|
2014-11-07 14:27:56 +00:00
|
|
|
|
#include "gdk-private.h"
|
2010-05-14 15:23:33 +00:00
|
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include <math.h>
|
|
|
|
|
|
2014-10-09 08:45:44 +00:00
|
|
|
|
#include <epoxy/gl.h>
|
|
|
|
|
|
2013-02-21 07:54:18 +00:00
|
|
|
|
/* for the use of round() */
|
|
|
|
|
#include "fallback-c89.c"
|
|
|
|
|
|
2014-08-21 15:26:18 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
|
|
|
|
#include "wayland/gdkwayland.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-05-13 02:51:37 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* SECTION:gdksurface
|
|
|
|
|
* @Short_description: Onscreen display areas in the target window system
|
|
|
|
|
* @Title: Surfaces
|
|
|
|
|
*
|
|
|
|
|
* A #GdkSurface is a (usually) rectangular region on the screen.
|
|
|
|
|
* It’s a low-level object, used to implement high-level objects such as
|
2019-03-24 19:42:32 +00:00
|
|
|
|
* #GtkWindow on the GTK level.
|
2019-04-06 16:36:51 +00:00
|
|
|
|
*/
|
2010-05-13 02:51:37 +00:00
|
|
|
|
|
2017-12-26 19:39:24 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* GdkSurface:
|
|
|
|
|
*
|
|
|
|
|
* The GdkSurface struct contains only private fields and
|
|
|
|
|
* should not be accessed directly.
|
|
|
|
|
*/
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2009-06-04 18:15:29 +00:00
|
|
|
|
enum {
|
2019-04-06 16:36:51 +00:00
|
|
|
|
MOVED_TO_RECT,
|
|
|
|
|
SIZE_CHANGED,
|
|
|
|
|
RENDER,
|
|
|
|
|
EVENT,
|
|
|
|
|
LAST_SIGNAL
|
2009-06-04 18:15:29 +00:00
|
|
|
|
};
|
|
|
|
|
|
2009-07-16 06:16:01 +00:00
|
|
|
|
enum {
|
2019-04-06 16:36:51 +00:00
|
|
|
|
PROP_0,
|
2019-05-22 22:35:09 +00:00
|
|
|
|
PROP_SURFACE_TYPE,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
PROP_CURSOR,
|
|
|
|
|
PROP_DISPLAY,
|
2019-05-08 04:36:59 +00:00
|
|
|
|
PROP_PARENT,
|
2019-04-22 01:14:28 +00:00
|
|
|
|
PROP_FRAME_CLOCK,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
PROP_STATE,
|
|
|
|
|
PROP_MAPPED,
|
2019-04-22 21:31:33 +00:00
|
|
|
|
PROP_AUTOHIDE,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
LAST_PROP
|
2009-07-16 06:16:01 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
/* Global info */
|
Bug 318807 – Offscreen windows and window redirection.
2008-03-18 10:49:20 Tim Janik <timj@imendio.com>
* Applied pixmap redirection patch by Alexander Larsson with
various updates from:
Bug 318807 – Offscreen windows and window redirection.
Updates:
* updated docs to mention "Since 2.16".
* tests/testgtk.c: fixed snapshooting pixmap leak.
convert pixmap to pixbuf after snapshooting, to compensate for different
bit depths (occurs when snapshooting ARGB visuals and displaying the
pixmap in an RGB visual).
* gdk/gdkwindow.[hc]: made GdkWindowRedirect private.
* gdk/gdkwindow.c: removed damage idle handler, there's no aparent
need for it. enqueue damage notification as GDK_DAMAGE events
for each painting redirection at the start of the event queue.
consider windows with a redirection fully visible when invalidating,
and when updating from backing store. cleaned up stale variables.
* gdk/gdkevents.c: added _gdk_event_queue_prepend().
* gtk/gtkwidget.c: fixed coordinates for !NO_WINDOW widgets in
gtk_widget_get_snapshot; this fixes garbage snap offsets for gammacurve,
tree, drawingarea, text, handlebox, etc.
clip the redirected window hierarchy to window sizes, the visible
rectangles don't need to be taken into account here.
extended snapshooting docs to recommend gdk_pixbuf_get_from_drawable()
in case pixmap visuals could mismatch.
* gdk/x11/gdkwindow-x11.c: removed _gdk_windowing_window_get_visible_rect().
Base patch:
* tests/testgtk.c: add a "Snapshot" test to demonstrate snapshooting
of possibly obscured widgets into an offscreen pixmap.
* gtk/gtkwidget.[hc]: add GtkWidget::damage-event signal, add
gtk_widget_get_snapshot() to render a widget's contents to a GdkPixmap.
* gtk/gtkmain.c: dispatch GDK_DAMAGE events.
* gdk/gdkwindow.c: moved outer gdk_window_new() and gdk_window_reparent()
implementations here, adapted them to propagate redirects to child windows.
gdk_window_end_paint(): copy repainted window contents to redirection pixmap,
clipped to visible region. queue GDK_DAMAGE event delivery.
gdk_window_redirect_to_drawable(): install window painting redirection.
gdk_window_remove_redirection(): remove previously installed redirection.
* gdk/x11/gdkwindow-x11.c: added _gdk_windowing_window_get_visible_rect(),
renamed _gdk_window_new() and _gdk_window_reparent().
* gdk/gdkwindow.h: added GdkWindowRedirect* to GdkWindowObject, export
gdk_window_redirect_to_drawable() and gdk_window_remove_redirection().
* gdk/gdkevents.h: added GDK_DAMAGE event type.
* gdk/gdkevents.c: extract time and state from GDK_DAMAGE events.
* gdk/gdkinternals.h: added internal prototypes.
svn path=/trunk/; revision=20122
2008-05-21 19:04:24 +00:00
|
|
|
|
|
2019-05-22 22:04:45 +00:00
|
|
|
|
static void gdk_surface_finalize (GObject *object);
|
2009-07-16 06:16:01 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
static void gdk_surface_set_property (GObject *object,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2018-03-20 10:40:08 +00:00
|
|
|
|
static void gdk_surface_get_property (GObject *object,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2009-07-16 06:16:01 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
static void update_cursor (GdkDisplay *display,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDevice *device);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
static void gdk_surface_set_frame_clock (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkFrameClock *clock);
|
2012-10-03 22:34:01 +00:00
|
|
|
|
|
2014-10-09 08:45:44 +00:00
|
|
|
|
|
2009-06-04 18:15:29 +00:00
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
2015-09-06 19:02:34 +00:00
|
|
|
|
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
2006-05-31 03:34:04 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
G_DEFINE_ABSTRACT_TYPE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_surface_real_beep (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkDisplay *
|
|
|
|
|
get_display_for_surface (GdkSurface *primary,
|
|
|
|
|
GdkSurface *secondary)
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display = gdk_surface_get_display (primary);
|
|
|
|
|
|
|
|
|
|
if (display)
|
|
|
|
|
return display;
|
|
|
|
|
|
|
|
|
|
display = gdk_surface_get_display (secondary);
|
|
|
|
|
|
|
|
|
|
if (display)
|
|
|
|
|
return display;
|
|
|
|
|
|
|
|
|
|
g_warning ("no display for surface, using default");
|
|
|
|
|
return gdk_display_get_default ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkMonitor *
|
|
|
|
|
get_monitor_for_rect (GdkDisplay *display,
|
|
|
|
|
const GdkRectangle *rect)
|
|
|
|
|
{
|
|
|
|
|
gint biggest_area = G_MININT;
|
|
|
|
|
GdkMonitor *best_monitor = NULL;
|
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
|
GdkRectangle workarea;
|
|
|
|
|
GdkRectangle intersection;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < gdk_display_get_n_monitors (display); i++)
|
|
|
|
|
{
|
|
|
|
|
monitor = gdk_display_get_monitor (display, i);
|
|
|
|
|
gdk_monitor_get_workarea (monitor, &workarea);
|
|
|
|
|
|
|
|
|
|
if (gdk_rectangle_intersect (&workarea, rect, &intersection))
|
|
|
|
|
{
|
|
|
|
|
if (intersection.width * intersection.height > biggest_area)
|
|
|
|
|
{
|
|
|
|
|
biggest_area = intersection.width * intersection.height;
|
|
|
|
|
best_monitor = monitor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-29 05:50:48 +00:00
|
|
|
|
return best_monitor;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
get_anchor_x_sign (GdkGravity anchor)
|
|
|
|
|
{
|
|
|
|
|
switch (anchor)
|
|
|
|
|
{
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
|
|
|
|
case GDK_GRAVITY_NORTH_WEST:
|
|
|
|
|
case GDK_GRAVITY_WEST:
|
|
|
|
|
case GDK_GRAVITY_SOUTH_WEST:
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
case GDK_GRAVITY_NORTH:
|
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case GDK_GRAVITY_NORTH_EAST:
|
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
get_anchor_y_sign (GdkGravity anchor)
|
|
|
|
|
{
|
|
|
|
|
switch (anchor)
|
|
|
|
|
{
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
|
|
|
|
case GDK_GRAVITY_NORTH_WEST:
|
|
|
|
|
case GDK_GRAVITY_NORTH:
|
|
|
|
|
case GDK_GRAVITY_NORTH_EAST:
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
case GDK_GRAVITY_WEST:
|
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case GDK_GRAVITY_SOUTH_WEST:
|
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
maybe_flip_position (gint bounds_pos,
|
|
|
|
|
gint bounds_size,
|
|
|
|
|
gint rect_pos,
|
|
|
|
|
gint rect_size,
|
|
|
|
|
gint surface_size,
|
|
|
|
|
gint rect_sign,
|
|
|
|
|
gint surface_sign,
|
|
|
|
|
gint offset,
|
|
|
|
|
gboolean flip,
|
|
|
|
|
gboolean *flipped)
|
|
|
|
|
{
|
|
|
|
|
gint primary;
|
|
|
|
|
gint secondary;
|
|
|
|
|
|
|
|
|
|
*flipped = FALSE;
|
|
|
|
|
primary = rect_pos + (1 + rect_sign) * rect_size / 2 + offset - (1 + surface_sign) * surface_size / 2;
|
|
|
|
|
|
|
|
|
|
if (!flip || (primary >= bounds_pos && primary + surface_size <= bounds_pos + bounds_size))
|
|
|
|
|
return primary;
|
|
|
|
|
|
|
|
|
|
*flipped = TRUE;
|
|
|
|
|
secondary = rect_pos + (1 - rect_sign) * rect_size / 2 - offset - (1 - surface_sign) * surface_size / 2;
|
|
|
|
|
|
|
|
|
|
if (secondary >= bounds_pos && secondary + surface_size <= bounds_pos + bounds_size)
|
|
|
|
|
return secondary;
|
|
|
|
|
|
|
|
|
|
*flipped = FALSE;
|
|
|
|
|
return primary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_surface_real_move_to_rect (GdkSurface *surface,
|
|
|
|
|
const GdkRectangle *rect,
|
|
|
|
|
GdkGravity rect_anchor,
|
|
|
|
|
GdkGravity surface_anchor,
|
|
|
|
|
GdkAnchorHints anchor_hints,
|
|
|
|
|
gint rect_anchor_dx,
|
|
|
|
|
gint rect_anchor_dy)
|
|
|
|
|
{
|
2019-04-22 15:17:53 +00:00
|
|
|
|
GdkSurface *toplevel;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
|
GdkRectangle bounds;
|
|
|
|
|
GdkRectangle root_rect = *rect;
|
|
|
|
|
GdkRectangle flipped_rect;
|
|
|
|
|
GdkRectangle final_rect;
|
|
|
|
|
gboolean flipped_x;
|
|
|
|
|
gboolean flipped_y;
|
2019-05-22 23:47:59 +00:00
|
|
|
|
int x, y;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
|
2019-04-22 15:17:53 +00:00
|
|
|
|
/* This implementation only works for backends that
|
|
|
|
|
* can provide root coordinates via get_root_coords.
|
|
|
|
|
* Other backends need to implement move_to_rect.
|
2019-04-22 01:14:46 +00:00
|
|
|
|
*/
|
2019-04-22 15:17:53 +00:00
|
|
|
|
if (surface->surface_type == GDK_SURFACE_POPUP)
|
|
|
|
|
toplevel = surface->parent;
|
|
|
|
|
else
|
|
|
|
|
toplevel = surface->transient_for;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
|
2019-04-22 15:17:53 +00:00
|
|
|
|
gdk_surface_get_root_coords (toplevel,
|
|
|
|
|
root_rect.x,
|
|
|
|
|
root_rect.y,
|
|
|
|
|
&root_rect.x,
|
|
|
|
|
&root_rect.y);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
|
|
|
|
|
display = get_display_for_surface (surface, surface->transient_for);
|
|
|
|
|
monitor = get_monitor_for_rect (display, &root_rect);
|
|
|
|
|
gdk_monitor_get_workarea (monitor, &bounds);
|
|
|
|
|
|
|
|
|
|
flipped_rect.width = surface->width - surface->shadow_left - surface->shadow_right;
|
|
|
|
|
flipped_rect.height = surface->height - surface->shadow_top - surface->shadow_bottom;
|
|
|
|
|
flipped_rect.x = maybe_flip_position (bounds.x,
|
|
|
|
|
bounds.width,
|
|
|
|
|
root_rect.x,
|
|
|
|
|
root_rect.width,
|
|
|
|
|
flipped_rect.width,
|
|
|
|
|
get_anchor_x_sign (rect_anchor),
|
|
|
|
|
get_anchor_x_sign (surface_anchor),
|
|
|
|
|
rect_anchor_dx,
|
|
|
|
|
anchor_hints & GDK_ANCHOR_FLIP_X,
|
|
|
|
|
&flipped_x);
|
|
|
|
|
flipped_rect.y = maybe_flip_position (bounds.y,
|
|
|
|
|
bounds.height,
|
|
|
|
|
root_rect.y,
|
|
|
|
|
root_rect.height,
|
|
|
|
|
flipped_rect.height,
|
|
|
|
|
get_anchor_y_sign (rect_anchor),
|
|
|
|
|
get_anchor_y_sign (surface_anchor),
|
|
|
|
|
rect_anchor_dy,
|
|
|
|
|
anchor_hints & GDK_ANCHOR_FLIP_Y,
|
|
|
|
|
&flipped_y);
|
|
|
|
|
|
|
|
|
|
final_rect = flipped_rect;
|
|
|
|
|
|
|
|
|
|
if (anchor_hints & GDK_ANCHOR_SLIDE_X)
|
|
|
|
|
{
|
|
|
|
|
if (final_rect.x + final_rect.width > bounds.x + bounds.width)
|
|
|
|
|
final_rect.x = bounds.x + bounds.width - final_rect.width;
|
|
|
|
|
|
|
|
|
|
if (final_rect.x < bounds.x)
|
|
|
|
|
final_rect.x = bounds.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anchor_hints & GDK_ANCHOR_SLIDE_Y)
|
|
|
|
|
{
|
|
|
|
|
if (final_rect.y + final_rect.height > bounds.y + bounds.height)
|
|
|
|
|
final_rect.y = bounds.y + bounds.height - final_rect.height;
|
|
|
|
|
|
|
|
|
|
if (final_rect.y < bounds.y)
|
|
|
|
|
final_rect.y = bounds.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anchor_hints & GDK_ANCHOR_RESIZE_X)
|
|
|
|
|
{
|
|
|
|
|
if (final_rect.x < bounds.x)
|
|
|
|
|
{
|
|
|
|
|
final_rect.width -= bounds.x - final_rect.x;
|
|
|
|
|
final_rect.x = bounds.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (final_rect.x + final_rect.width > bounds.x + bounds.width)
|
|
|
|
|
final_rect.width = bounds.x + bounds.width - final_rect.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anchor_hints & GDK_ANCHOR_RESIZE_Y)
|
|
|
|
|
{
|
|
|
|
|
if (final_rect.y < bounds.y)
|
|
|
|
|
{
|
|
|
|
|
final_rect.height -= bounds.y - final_rect.y;
|
|
|
|
|
final_rect.y = bounds.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (final_rect.y + final_rect.height > bounds.y + bounds.height)
|
|
|
|
|
final_rect.height = bounds.y + bounds.height - final_rect.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flipped_rect.x -= surface->shadow_left;
|
|
|
|
|
flipped_rect.y -= surface->shadow_top;
|
|
|
|
|
flipped_rect.width += surface->shadow_left + surface->shadow_right;
|
|
|
|
|
flipped_rect.height += surface->shadow_top + surface->shadow_bottom;
|
|
|
|
|
|
|
|
|
|
final_rect.x -= surface->shadow_left;
|
|
|
|
|
final_rect.y -= surface->shadow_top;
|
|
|
|
|
final_rect.width += surface->shadow_left + surface->shadow_right;
|
|
|
|
|
final_rect.height += surface->shadow_top + surface->shadow_bottom;
|
|
|
|
|
|
|
|
|
|
if (final_rect.width != surface->width || final_rect.height != surface->height)
|
|
|
|
|
gdk_surface_move_resize (surface, final_rect.x, final_rect.y, final_rect.width, final_rect.height);
|
|
|
|
|
else
|
|
|
|
|
gdk_surface_move (surface, final_rect.x, final_rect.y);
|
|
|
|
|
|
2019-05-22 23:47:59 +00:00
|
|
|
|
gdk_surface_get_origin (toplevel, &x, &y);
|
|
|
|
|
final_rect.x -= x;
|
|
|
|
|
final_rect.y -= y;
|
|
|
|
|
flipped_rect.x -= x;
|
|
|
|
|
flipped_rect.y -= y;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
g_signal_emit_by_name (surface,
|
|
|
|
|
"moved-to-rect",
|
|
|
|
|
&flipped_rect,
|
|
|
|
|
&final_rect,
|
|
|
|
|
flipped_x,
|
|
|
|
|
flipped_y);
|
|
|
|
|
}
|
|
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_init (GdkSurface *surface)
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* 0-initialization is good for all other fields. */
|
1998-03-07 18:38:18 +00:00
|
|
|
|
|
2019-03-22 18:24:39 +00:00
|
|
|
|
surface->surface_type = GDK_SURFACE_TOPLEVEL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->state = GDK_SURFACE_STATE_WITHDRAWN;
|
|
|
|
|
surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
|
|
|
|
|
surface->width = 1;
|
|
|
|
|
surface->height = 1;
|
2011-05-03 22:01:10 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
surface->accept_focus = TRUE;
|
|
|
|
|
surface->focus_on_map = TRUE;
|
|
|
|
|
surface->alpha = 255;
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->device_cursor = g_hash_table_new_full (NULL, NULL,
|
|
|
|
|
NULL, g_object_unref);
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
}
|
1999-01-17 22:58:59 +00:00
|
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_class_init (GdkSurfaceClass *klass)
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
object_class->finalize = gdk_surface_finalize;
|
|
|
|
|
object_class->set_property = gdk_surface_set_property;
|
|
|
|
|
object_class->get_property = gdk_surface_get_property;
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
klass->beep = gdk_surface_real_beep;
|
|
|
|
|
klass->move_to_rect = gdk_surface_real_move_to_rect;
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* GdkSurface:cursor:
|
|
|
|
|
*
|
|
|
|
|
* The mouse pointer for a #GdkSurface. See gdk_surface_set_cursor() and
|
|
|
|
|
* gdk_surface_get_cursor() for details.
|
|
|
|
|
*/
|
|
|
|
|
properties[PROP_CURSOR] =
|
|
|
|
|
g_param_spec_object ("cursor",
|
|
|
|
|
P_("Cursor"),
|
|
|
|
|
P_("Cursor"),
|
|
|
|
|
GDK_TYPE_CURSOR,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GdkSurface:display:
|
|
|
|
|
*
|
|
|
|
|
* The #GdkDisplay connection of the surface. See gdk_surface_get_display()
|
|
|
|
|
* for details.
|
|
|
|
|
*/
|
|
|
|
|
properties[PROP_DISPLAY] =
|
|
|
|
|
g_param_spec_object ("display",
|
|
|
|
|
P_("Display"),
|
|
|
|
|
P_("Display"),
|
|
|
|
|
GDK_TYPE_DISPLAY,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
2019-05-08 04:36:59 +00:00
|
|
|
|
properties[PROP_PARENT] =
|
|
|
|
|
g_param_spec_object ("parent",
|
|
|
|
|
P_("Parent"),
|
|
|
|
|
P_("Parent surface"),
|
|
|
|
|
GDK_TYPE_SURFACE,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
2019-04-22 01:14:28 +00:00
|
|
|
|
properties[PROP_FRAME_CLOCK] =
|
|
|
|
|
g_param_spec_object ("frame-clock",
|
|
|
|
|
P_("Frame Clock"),
|
|
|
|
|
P_("Frame Clock"),
|
|
|
|
|
GDK_TYPE_FRAME_CLOCK,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
properties[PROP_STATE] =
|
|
|
|
|
g_param_spec_flags ("state",
|
|
|
|
|
P_("State"),
|
|
|
|
|
P_("State"),
|
|
|
|
|
GDK_TYPE_SURFACE_STATE, GDK_SURFACE_STATE_WITHDRAWN,
|
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
|
|
properties[PROP_MAPPED] =
|
|
|
|
|
g_param_spec_boolean ("mapped",
|
|
|
|
|
P_("Mapped"),
|
|
|
|
|
P_("Mapped"),
|
|
|
|
|
FALSE,
|
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
2019-04-22 21:31:33 +00:00
|
|
|
|
properties[PROP_AUTOHIDE] =
|
|
|
|
|
g_param_spec_boolean ("autohide",
|
|
|
|
|
P_("Autohide"),
|
|
|
|
|
P_("Whether to dismiss the surface on outside clicks"),
|
|
|
|
|
FALSE,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
2019-05-22 22:35:09 +00:00
|
|
|
|
properties[PROP_SURFACE_TYPE] =
|
|
|
|
|
g_param_spec_enum ("surface-type",
|
|
|
|
|
P_("Surface type"),
|
|
|
|
|
P_("Surface type"),
|
|
|
|
|
GDK_TYPE_SURFACE_TYPE, GDK_SURFACE_TOPLEVEL,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GdkSurface::moved-to-rect:
|
|
|
|
|
* @surface: the #GdkSurface that moved
|
|
|
|
|
* @flipped_rect: (nullable): the position of @surface after any possible
|
|
|
|
|
* flipping or %NULL if the backend can't obtain it
|
|
|
|
|
* @final_rect: (nullable): the final position of @surface or %NULL if the
|
|
|
|
|
* backend can't obtain it
|
|
|
|
|
* @flipped_x: %TRUE if the anchors were flipped horizontally
|
|
|
|
|
* @flipped_y: %TRUE if the anchors were flipped vertically
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the position of @surface is finalized after being moved to a
|
|
|
|
|
* destination rectangle.
|
|
|
|
|
*
|
|
|
|
|
* @surface might be flipped over the destination rectangle in order to keep
|
|
|
|
|
* it on-screen, in which case @flipped_x and @flipped_y will be set to %TRUE
|
|
|
|
|
* accordingly.
|
|
|
|
|
*
|
|
|
|
|
* @flipped_rect is the ideal position of @surface after any possible
|
|
|
|
|
* flipping, but before any possible sliding. @final_rect is @flipped_rect,
|
|
|
|
|
* but possibly translated in the case that flipping is still ineffective in
|
|
|
|
|
* keeping @surface on-screen.
|
|
|
|
|
* Stability: Private
|
|
|
|
|
*/
|
|
|
|
|
signals[MOVED_TO_RECT] =
|
|
|
|
|
g_signal_new (g_intern_static_string ("moved-to-rect"),
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
0,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
_gdk_marshal_VOID__POINTER_POINTER_BOOLEAN_BOOLEAN,
|
|
|
|
|
G_TYPE_NONE,
|
|
|
|
|
4,
|
|
|
|
|
G_TYPE_POINTER,
|
|
|
|
|
G_TYPE_POINTER,
|
|
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
|
G_TYPE_BOOLEAN);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GdkSurface::size-changed:
|
|
|
|
|
* @surface: the #GdkSurface
|
|
|
|
|
* @width: the new width
|
|
|
|
|
* @height: the new height
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the size of @surface is changed.
|
|
|
|
|
*/
|
|
|
|
|
signals[SIZE_CHANGED] =
|
|
|
|
|
g_signal_new (g_intern_static_string ("size-changed"),
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
0,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
G_TYPE_NONE,
|
|
|
|
|
2,
|
|
|
|
|
G_TYPE_INT,
|
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GdkSurface::render:
|
|
|
|
|
* @surface: the #GdkSurface
|
|
|
|
|
* @region: the region that needs to be redrawn
|
|
|
|
|
*
|
|
|
|
|
* Emitted when part of the surface needs to be redrawn.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE to indicate that the signal has been handled
|
|
|
|
|
*/
|
|
|
|
|
signals[RENDER] =
|
|
|
|
|
g_signal_new (g_intern_static_string ("render"),
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
|
0,
|
|
|
|
|
g_signal_accumulator_true_handled,
|
|
|
|
|
NULL,
|
2019-05-28 17:18:35 +00:00
|
|
|
|
_gdk_marshal_BOOLEAN__BOXED,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
|
1,
|
|
|
|
|
CAIRO_GOBJECT_TYPE_REGION);
|
2019-05-28 17:18:35 +00:00
|
|
|
|
g_signal_set_va_marshaller (signals[RENDER],
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
_gdk_marshal_BOOLEAN__BOXEDv);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GdkSurface::event:
|
|
|
|
|
* @surface: the #GdkSurface
|
|
|
|
|
* @event: an input event
|
|
|
|
|
*
|
|
|
|
|
* Emitted when GDK receives an input event for @surface.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE to indicate that the event has been handled
|
|
|
|
|
*/
|
|
|
|
|
signals[EVENT] =
|
|
|
|
|
g_signal_new (g_intern_static_string ("event"),
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
|
0,
|
|
|
|
|
g_signal_accumulator_true_handled,
|
|
|
|
|
NULL,
|
2019-05-28 17:18:35 +00:00
|
|
|
|
_gdk_marshal_BOOLEAN__OBJECT,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
|
1,
|
|
|
|
|
GDK_TYPE_EVENT);
|
2019-05-28 17:18:35 +00:00
|
|
|
|
g_signal_set_va_marshaller (signals[EVENT],
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
_gdk_marshal_BOOLEAN__OBJECTv);
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
}
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
static void
|
2015-12-15 22:22:00 +00:00
|
|
|
|
seat_removed_cb (GdkDisplay *display,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkSeat *seat,
|
|
|
|
|
GdkSurface *surface)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDevice *device = gdk_seat_get_pointer (seat);
|
2015-12-15 22:22:00 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->devices_inside = g_list_remove (surface->devices_inside, device);
|
|
|
|
|
g_hash_table_remove (surface->device_cursor, device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_finalize (GObject *object)
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (gdk_surface_get_display (surface),
|
|
|
|
|
seat_removed_cb, surface);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (!GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
{
|
|
|
|
|
g_warning ("losing last reference to undestroyed surface");
|
|
|
|
|
_gdk_surface_destroy (surface, FALSE);
|
|
|
|
|
}
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->input_shape)
|
|
|
|
|
cairo_region_destroy (surface->input_shape);
|
2008-12-17 10:24:46 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->cursor)
|
|
|
|
|
g_object_unref (surface->cursor);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->device_cursor)
|
|
|
|
|
g_hash_table_destroy (surface->device_cursor);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->devices_inside)
|
|
|
|
|
g_list_free (surface->devices_inside);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_clear_object (&surface->display);
|
2016-10-27 13:38:41 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->opaque_region)
|
|
|
|
|
cairo_region_destroy (surface->opaque_region);
|
2017-08-18 10:01:54 +00:00
|
|
|
|
|
2019-05-22 22:04:45 +00:00
|
|
|
|
if (surface->parent)
|
|
|
|
|
surface->parent->children = g_list_remove (surface->parent->children, surface);
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
G_OBJECT_CLASS (gdk_surface_parent_class)->finalize (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-07-16 06:16:01 +00:00
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_set_property (GObject *object,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2019-03-25 12:33:56 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_CURSOR:
|
|
|
|
|
gdk_surface_set_cursor (surface, g_value_get_object (value));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PROP_DISPLAY:
|
|
|
|
|
surface->display = g_value_dup_object (value);
|
|
|
|
|
g_assert (surface->display != NULL);
|
2019-05-26 03:55:08 +00:00
|
|
|
|
g_signal_connect (surface->display, "seat-removed",
|
|
|
|
|
G_CALLBACK (seat_removed_cb), surface);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2019-05-08 04:36:59 +00:00
|
|
|
|
case PROP_PARENT:
|
|
|
|
|
surface->parent = g_value_dup_object (value);
|
2019-05-26 03:55:08 +00:00
|
|
|
|
if (surface->parent != NULL)
|
|
|
|
|
surface->parent->children = g_list_prepend (surface->parent->children, surface);
|
2019-05-08 04:36:59 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2019-04-22 01:14:28 +00:00
|
|
|
|
case PROP_FRAME_CLOCK:
|
|
|
|
|
gdk_surface_set_frame_clock (surface, GDK_FRAME_CLOCK (g_value_get_object (value)));
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-22 21:31:33 +00:00
|
|
|
|
case PROP_AUTOHIDE:
|
|
|
|
|
surface->autohide = g_value_get_boolean (value);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-05-22 22:35:09 +00:00
|
|
|
|
case PROP_SURFACE_TYPE:
|
|
|
|
|
surface->surface_type = g_value_get_enum (value);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-07-16 06:16:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_get_property (GObject *object,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2009-07-16 06:16:01 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
2009-07-16 06:16:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_CURSOR:
|
|
|
|
|
g_value_set_object (value, gdk_surface_get_cursor (surface));
|
|
|
|
|
break;
|
2009-07-16 06:16:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
case PROP_DISPLAY:
|
|
|
|
|
g_value_set_object (value, surface->display);
|
|
|
|
|
break;
|
2016-10-27 13:38:41 +00:00
|
|
|
|
|
2019-05-08 04:36:59 +00:00
|
|
|
|
case PROP_PARENT:
|
|
|
|
|
g_value_set_object (value, surface->parent);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-22 01:14:28 +00:00
|
|
|
|
case PROP_FRAME_CLOCK:
|
|
|
|
|
g_value_set_object (value, surface->frame_clock);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
case PROP_STATE:
|
|
|
|
|
g_value_set_flags (value, surface->state);
|
|
|
|
|
break;
|
2017-12-14 23:51:38 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
case PROP_MAPPED:
|
|
|
|
|
g_value_set_boolean (value, GDK_SURFACE_IS_MAPPED (surface));
|
|
|
|
|
break;
|
2018-07-15 18:23:54 +00:00
|
|
|
|
|
2019-04-22 21:31:33 +00:00
|
|
|
|
case PROP_AUTOHIDE:
|
|
|
|
|
g_value_set_boolean (value, surface->autohide);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-05-22 22:35:09 +00:00
|
|
|
|
case PROP_SURFACE_TYPE:
|
|
|
|
|
g_value_set_enum (value, surface->surface_type);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-07-16 06:16:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_update_size (GdkSurface *surface)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GSList *l;
|
2018-04-08 22:35:32 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
for (l = surface->draw_contexts; l; l = l->next)
|
|
|
|
|
gdk_draw_context_surface_resized (l->data);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-23 12:36:25 +00:00
|
|
|
|
static GdkSurface *
|
|
|
|
|
gdk_surface_new (GdkDisplay *display,
|
|
|
|
|
GdkSurfaceType surface_type,
|
2019-04-21 16:51:10 +00:00
|
|
|
|
GdkSurface *parent,
|
2019-03-23 12:36:25 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
Bug 318807 – Offscreen windows and window redirection.
2008-03-18 10:49:20 Tim Janik <timj@imendio.com>
* Applied pixmap redirection patch by Alexander Larsson with
various updates from:
Bug 318807 – Offscreen windows and window redirection.
Updates:
* updated docs to mention "Since 2.16".
* tests/testgtk.c: fixed snapshooting pixmap leak.
convert pixmap to pixbuf after snapshooting, to compensate for different
bit depths (occurs when snapshooting ARGB visuals and displaying the
pixmap in an RGB visual).
* gdk/gdkwindow.[hc]: made GdkWindowRedirect private.
* gdk/gdkwindow.c: removed damage idle handler, there's no aparent
need for it. enqueue damage notification as GDK_DAMAGE events
for each painting redirection at the start of the event queue.
consider windows with a redirection fully visible when invalidating,
and when updating from backing store. cleaned up stale variables.
* gdk/gdkevents.c: added _gdk_event_queue_prepend().
* gtk/gtkwidget.c: fixed coordinates for !NO_WINDOW widgets in
gtk_widget_get_snapshot; this fixes garbage snap offsets for gammacurve,
tree, drawingarea, text, handlebox, etc.
clip the redirected window hierarchy to window sizes, the visible
rectangles don't need to be taken into account here.
extended snapshooting docs to recommend gdk_pixbuf_get_from_drawable()
in case pixmap visuals could mismatch.
* gdk/x11/gdkwindow-x11.c: removed _gdk_windowing_window_get_visible_rect().
Base patch:
* tests/testgtk.c: add a "Snapshot" test to demonstrate snapshooting
of possibly obscured widgets into an offscreen pixmap.
* gtk/gtkwidget.[hc]: add GtkWidget::damage-event signal, add
gtk_widget_get_snapshot() to render a widget's contents to a GdkPixmap.
* gtk/gtkmain.c: dispatch GDK_DAMAGE events.
* gdk/gdkwindow.c: moved outer gdk_window_new() and gdk_window_reparent()
implementations here, adapted them to propagate redirects to child windows.
gdk_window_end_paint(): copy repainted window contents to redirection pixmap,
clipped to visible region. queue GDK_DAMAGE event delivery.
gdk_window_redirect_to_drawable(): install window painting redirection.
gdk_window_remove_redirection(): remove previously installed redirection.
* gdk/x11/gdkwindow-x11.c: added _gdk_windowing_window_get_visible_rect(),
renamed _gdk_window_new() and _gdk_window_reparent().
* gdk/gdkwindow.h: added GdkWindowRedirect* to GdkWindowObject, export
gdk_window_redirect_to_drawable() and gdk_window_remove_redirection().
* gdk/gdkevents.h: added GDK_DAMAGE event type.
* gdk/gdkevents.c: extract time and state from GDK_DAMAGE events.
* gdk/gdkinternals.h: added internal prototypes.
svn path=/trunk/; revision=20122
2008-05-21 19:04:24 +00:00
|
|
|
|
{
|
2019-05-26 03:55:08 +00:00
|
|
|
|
return gdk_display_create_surface (display,
|
|
|
|
|
surface_type,
|
|
|
|
|
parent,
|
|
|
|
|
x, y, width, height);
|
Bug 318807 – Offscreen windows and window redirection.
2008-03-18 10:49:20 Tim Janik <timj@imendio.com>
* Applied pixmap redirection patch by Alexander Larsson with
various updates from:
Bug 318807 – Offscreen windows and window redirection.
Updates:
* updated docs to mention "Since 2.16".
* tests/testgtk.c: fixed snapshooting pixmap leak.
convert pixmap to pixbuf after snapshooting, to compensate for different
bit depths (occurs when snapshooting ARGB visuals and displaying the
pixmap in an RGB visual).
* gdk/gdkwindow.[hc]: made GdkWindowRedirect private.
* gdk/gdkwindow.c: removed damage idle handler, there's no aparent
need for it. enqueue damage notification as GDK_DAMAGE events
for each painting redirection at the start of the event queue.
consider windows with a redirection fully visible when invalidating,
and when updating from backing store. cleaned up stale variables.
* gdk/gdkevents.c: added _gdk_event_queue_prepend().
* gtk/gtkwidget.c: fixed coordinates for !NO_WINDOW widgets in
gtk_widget_get_snapshot; this fixes garbage snap offsets for gammacurve,
tree, drawingarea, text, handlebox, etc.
clip the redirected window hierarchy to window sizes, the visible
rectangles don't need to be taken into account here.
extended snapshooting docs to recommend gdk_pixbuf_get_from_drawable()
in case pixmap visuals could mismatch.
* gdk/x11/gdkwindow-x11.c: removed _gdk_windowing_window_get_visible_rect().
Base patch:
* tests/testgtk.c: add a "Snapshot" test to demonstrate snapshooting
of possibly obscured widgets into an offscreen pixmap.
* gtk/gtkwidget.[hc]: add GtkWidget::damage-event signal, add
gtk_widget_get_snapshot() to render a widget's contents to a GdkPixmap.
* gtk/gtkmain.c: dispatch GDK_DAMAGE events.
* gdk/gdkwindow.c: moved outer gdk_window_new() and gdk_window_reparent()
implementations here, adapted them to propagate redirects to child windows.
gdk_window_end_paint(): copy repainted window contents to redirection pixmap,
clipped to visible region. queue GDK_DAMAGE event delivery.
gdk_window_redirect_to_drawable(): install window painting redirection.
gdk_window_remove_redirection(): remove previously installed redirection.
* gdk/x11/gdkwindow-x11.c: added _gdk_windowing_window_get_visible_rect(),
renamed _gdk_window_new() and _gdk_window_reparent().
* gdk/gdkwindow.h: added GdkWindowRedirect* to GdkWindowObject, export
gdk_window_redirect_to_drawable() and gdk_window_remove_redirection().
* gdk/gdkevents.h: added GDK_DAMAGE event type.
* gdk/gdkevents.c: extract time and state from GDK_DAMAGE events.
* gdk/gdkinternals.h: added internal prototypes.
svn path=/trunk/; revision=20122
2008-05-21 19:04:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-06 16:40:59 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_new_toplevel: (constructor)
|
|
|
|
|
* @display: the display to create the surface on
|
|
|
|
|
* @width: width of new surface
|
|
|
|
|
* @height: height of new surface
|
|
|
|
|
*
|
2019-04-21 16:51:10 +00:00
|
|
|
|
* Creates a new toplevel surface.
|
2019-04-06 16:36:51 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the new #GdkSurface
|
|
|
|
|
**/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurface *
|
|
|
|
|
gdk_surface_new_toplevel (GdkDisplay *display,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
gint width,
|
|
|
|
|
gint height)
|
2016-11-06 16:40:59 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
2016-11-06 16:40:59 +00:00
|
|
|
|
|
2019-04-21 16:51:10 +00:00
|
|
|
|
return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL,
|
|
|
|
|
NULL, 0, 0, width, height);
|
2016-11-06 16:40:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-06 22:47:56 +00:00
|
|
|
|
/**
|
2019-04-21 16:51:10 +00:00
|
|
|
|
* gdk_surface_new_temp: (constructor)
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* @display: the display to create the surface on
|
|
|
|
|
* @position: position of the surface on screen
|
|
|
|
|
*
|
2019-04-21 16:51:10 +00:00
|
|
|
|
* Creates a new temporary surface.
|
|
|
|
|
* The surface will bypass surface management.
|
2019-04-06 16:36:51 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the new #GdkSurface
|
|
|
|
|
**/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurface *
|
2019-04-21 16:51:10 +00:00
|
|
|
|
gdk_surface_new_temp (GdkDisplay *display,
|
|
|
|
|
const GdkRectangle *position)
|
2016-11-06 22:47:56 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
|
|
|
|
g_return_val_if_fail (position != NULL, NULL);
|
2016-11-06 22:47:56 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
return gdk_surface_new (display, GDK_SURFACE_TEMP,
|
2019-04-21 16:51:10 +00:00
|
|
|
|
NULL,
|
2019-03-23 12:36:25 +00:00
|
|
|
|
position->x, position->y,
|
|
|
|
|
position->width, position->height);
|
2016-11-06 22:47:56 +00:00
|
|
|
|
}
|
2016-11-07 00:03:17 +00:00
|
|
|
|
|
2019-03-20 00:05:17 +00:00
|
|
|
|
/**
|
2019-04-21 16:51:10 +00:00
|
|
|
|
* gdk_surface_new_popup: (constructor)
|
2019-03-20 00:05:17 +00:00
|
|
|
|
* @display: the display to create the surface on
|
|
|
|
|
* @parent: the parent surface to attach the surface to
|
2019-04-22 21:31:33 +00:00
|
|
|
|
* @autohide: whether to hide the surface on outside clicks
|
2019-03-20 00:05:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Create a new popup surface.
|
2019-04-22 21:31:33 +00:00
|
|
|
|
*
|
2019-03-20 00:05:17 +00:00
|
|
|
|
* The surface will be attached to @parent and can
|
|
|
|
|
* be positioned relative to it using
|
|
|
|
|
* gdk_surface_move_to_rect().
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): a new #GdkSurface
|
|
|
|
|
*/
|
|
|
|
|
GdkSurface *
|
2019-04-21 16:51:10 +00:00
|
|
|
|
gdk_surface_new_popup (GdkDisplay *display,
|
2019-04-22 21:31:33 +00:00
|
|
|
|
GdkSurface *parent,
|
|
|
|
|
gboolean autohide)
|
2019-03-20 00:05:17 +00:00
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
|
|
|
|
|
|
2019-04-22 13:16:26 +00:00
|
|
|
|
surface = gdk_surface_new (display, GDK_SURFACE_POPUP,
|
|
|
|
|
parent, 0, 0, 100, 100);
|
2019-04-21 16:51:10 +00:00
|
|
|
|
|
2019-04-22 21:31:33 +00:00
|
|
|
|
surface->autohide = autohide;
|
|
|
|
|
|
2019-03-20 00:05:17 +00:00
|
|
|
|
return surface;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-02 21:43:38 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_surface_get_parent:
|
|
|
|
|
* @surface: a #GtkSurface
|
|
|
|
|
*
|
|
|
|
|
* Returns the parent surface of a surface, or
|
|
|
|
|
* %NULL if the surface does not have a parent.
|
|
|
|
|
*
|
|
|
|
|
* Only popup surfaces have parents.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none) (nullable): the parent of
|
|
|
|
|
* @surface, or %NULL
|
|
|
|
|
*/
|
|
|
|
|
GdkSurface *
|
|
|
|
|
gdk_surface_get_parent (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
|
|
|
|
|
|
|
|
|
return surface->parent;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
static void
|
|
|
|
|
update_pointer_info_foreach (GdkDisplay *display,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GdkPointerSurfaceInfo *pointer_info,
|
|
|
|
|
gpointer user_data)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkSurface *surface = user_data;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (pointer_info->surface_under_pointer == surface)
|
|
|
|
|
{
|
|
|
|
|
g_object_unref (pointer_info->surface_under_pointer);
|
|
|
|
|
pointer_info->surface_under_pointer = NULL;
|
|
|
|
|
}
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface_remove_from_pointer_info (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDisplay *display)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
_gdk_display_pointer_info_foreach (display,
|
|
|
|
|
update_pointer_info_foreach,
|
|
|
|
|
surface);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* _gdk_surface_destroy_hierarchy:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @recursing_native: If %TRUE, then this is being called because a native parent
|
|
|
|
|
* was destroyed. This generally means that the call to the
|
|
|
|
|
* windowing system to destroy the surface can be omitted, since
|
|
|
|
|
* it will be destroyed as a result of the parent being destroyed.
|
|
|
|
|
* Unless @foreign_destroy.
|
|
|
|
|
* @foreign_destroy: If %TRUE, the surface or a parent was destroyed by some
|
|
|
|
|
* external agency. The surface has already been destroyed and no
|
|
|
|
|
* windowing system calls should be made. (This may never happen
|
|
|
|
|
* for some windowing systems.)
|
|
|
|
|
*
|
|
|
|
|
* Internal function to destroy a surface. Like gdk_surface_destroy(),
|
|
|
|
|
* but does not drop the reference count created by gdk_surface_new().
|
|
|
|
|
**/
|
2000-05-15 16:09:53 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_destroy_hierarchy (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
gboolean foreign_destroy)
|
2000-05-15 16:09:53 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDisplay *display;
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2009-02-28 05:24:07 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
return;
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-05-24 01:56:35 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->destroy (surface, foreign_destroy);
|
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
if (surface->gl_paint_context)
|
2000-05-15 16:09:53 +00:00
|
|
|
|
{
|
2019-03-24 20:24:30 +00:00
|
|
|
|
/* Make sure to destroy if current */
|
|
|
|
|
g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
|
|
|
|
|
g_object_unref (surface->gl_paint_context);
|
|
|
|
|
surface->gl_paint_context = NULL;
|
|
|
|
|
}
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
if (surface->frame_clock)
|
|
|
|
|
{
|
2019-05-20 13:19:12 +00:00
|
|
|
|
if (surface->parent == NULL)
|
|
|
|
|
g_object_run_dispose (G_OBJECT (surface->frame_clock));
|
2019-03-24 20:24:30 +00:00
|
|
|
|
gdk_surface_set_frame_clock (surface, NULL);
|
|
|
|
|
}
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
_gdk_surface_clear_update_area (surface);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
|
|
|
|
|
surface->destroyed = TRUE;
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
surface_remove_from_pointer_info (surface, display);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
2000-05-15 16:09:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* _gdk_surface_destroy:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @foreign_destroy: If %TRUE, the surface or a parent was destroyed by some
|
|
|
|
|
* external agency. The surface has already been destroyed and no
|
|
|
|
|
* windowing system calls should be made. (This may never happen
|
|
|
|
|
* for some windowing systems.)
|
|
|
|
|
*
|
|
|
|
|
* Internal function to destroy a surface. Like gdk_surface_destroy(),
|
|
|
|
|
* but does not drop the reference count created by gdk_surface_new().
|
|
|
|
|
**/
|
2000-05-15 16:09:53 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_destroy (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
gboolean foreign_destroy)
|
2000-05-15 16:09:53 +00:00
|
|
|
|
{
|
2019-03-24 20:24:30 +00:00
|
|
|
|
_gdk_surface_destroy_hierarchy (surface, foreign_destroy);
|
2000-05-15 16:09:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_destroy:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Destroys the window system resources associated with @surface and decrements @surface's
|
|
|
|
|
* reference count. The window system resources for all children of @surface are also
|
|
|
|
|
* destroyed, but the children’s reference counts are not decremented.
|
|
|
|
|
*
|
|
|
|
|
* Note that a surface will not be destroyed automatically when its reference count
|
|
|
|
|
* reaches zero. You must call this function yourself before that happens.
|
|
|
|
|
*
|
|
|
|
|
**/
|
2000-05-15 16:09:53 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_destroy (GdkSurface *surface)
|
2000-05-15 16:09:53 +00:00
|
|
|
|
{
|
2019-03-24 20:24:30 +00:00
|
|
|
|
_gdk_surface_destroy_hierarchy (surface, FALSE);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_object_unref (surface);
|
2000-05-15 16:09:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
2019-02-23 23:56:02 +00:00
|
|
|
|
gdk_surface_set_widget (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
gpointer widget)
|
1998-01-01 20:38:21 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->widget = widget;
|
1998-01-01 20:38:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-23 23:56:02 +00:00
|
|
|
|
gpointer
|
|
|
|
|
gdk_surface_get_widget (GdkSurface *surface)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return surface->widget;
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_get_surface_type:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Gets the type of the surface. See #GdkSurfaceType.
|
|
|
|
|
*
|
|
|
|
|
* Returns: type of surface
|
|
|
|
|
**/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceType
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_surface_type (GdkSurface *surface)
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), (GdkSurfaceType) -1);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return GDK_SURFACE_TYPE (surface);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-29 00:03:19 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_get_display:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Gets the #GdkDisplay associated with a #GdkSurface.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none): the #GdkDisplay associated with @surface
|
|
|
|
|
**/
|
2010-08-29 00:03:19 +00:00
|
|
|
|
GdkDisplay *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_display (GdkSurface *surface)
|
2010-08-29 00:03:19 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2010-08-29 00:03:19 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return surface->display;
|
2010-08-29 00:03:19 +00:00
|
|
|
|
}
|
2009-09-04 15:49:57 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_is_destroyed:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Check to see if a surface is destroyed..
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the surface is destroyed
|
|
|
|
|
**/
|
2009-09-04 15:49:57 +00:00
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_is_destroyed (GdkSurface *surface)
|
2009-09-04 15:49:57 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return GDK_SURFACE_DESTROYED (surface);
|
2009-09-04 15:49:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_get_position:
|
|
|
|
|
* @surface: a #GdkSurface
|
2019-05-29 04:30:03 +00:00
|
|
|
|
* @x: (out): X coordinate of surface
|
|
|
|
|
* @y: (out): Y coordinate of surface
|
2019-04-06 16:36:51 +00:00
|
|
|
|
*
|
2019-05-29 04:30:03 +00:00
|
|
|
|
* Obtains the position of the surface relative to its parent.
|
2019-04-06 16:36:51 +00:00
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_position (GdkSurface *surface,
|
2019-05-29 04:30:03 +00:00
|
|
|
|
int *x,
|
|
|
|
|
int *y)
|
1999-11-08 20:14:59 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-05-29 04:30:03 +00:00
|
|
|
|
if (surface->parent)
|
|
|
|
|
{
|
|
|
|
|
*x = surface->x;
|
|
|
|
|
*y = surface->y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*x = 0;
|
|
|
|
|
*y = 0;
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_is_visible:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Checks whether the surface has been mapped (with gdk_surface_show() or
|
|
|
|
|
* gdk_surface_show_unraised()).
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the surface is mapped
|
|
|
|
|
**/
|
2009-06-01 10:04:36 +00:00
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_is_visible (GdkSurface *surface)
|
1999-01-15 16:00:39 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return GDK_SURFACE_IS_MAPPED (surface);
|
1999-01-15 16:00:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_is_viewable:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Check if the surface and all ancestors of the surface are
|
|
|
|
|
* mapped. (This is not necessarily "viewable" in the X sense, since
|
|
|
|
|
* we only check as far as we have GDK surface parents, not to the root
|
|
|
|
|
* surface.)
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the surface is viewable
|
|
|
|
|
**/
|
2009-06-01 10:04:36 +00:00
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_is_viewable (GdkSurface *surface)
|
1999-01-15 16:00:39 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2003-06-09 01:55:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->destroyed)
|
|
|
|
|
return FALSE;
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return surface->viewable;
|
1999-01-15 16:00:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_get_state:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Gets the bitwise OR of the currently active surface state flags,
|
|
|
|
|
* from the #GdkSurfaceState enumeration.
|
|
|
|
|
*
|
|
|
|
|
* Returns: surface state bitfield
|
|
|
|
|
**/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceState
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_state (GdkSurface *surface)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return surface->state;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-09 08:45:44 +00:00
|
|
|
|
GdkGLContext *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_paint_gl_context (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GError **error)
|
2019-03-25 12:33:56 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GError *internal_error = NULL;
|
2014-10-09 08:45:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_DISPLAY_DEBUG_CHECK (surface->display, GL_DISABLE))
|
|
|
|
|
{
|
|
|
|
|
g_set_error_literal (error, GDK_GL_ERROR,
|
|
|
|
|
GDK_GL_ERROR_NOT_AVAILABLE,
|
|
|
|
|
_("GL support disabled via GDK_DEBUG"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
GL: Split GL context creation in two phases
One of the major requests by OpenGL users has been the ability to
specify settings when creating a GL context, like the version to use
or whether the debug support should be enabled.
We have a couple of requirements in terms of API:
• avoid, if at all possible, the "C arrays of integers with
attribute, value pairs", which are hard to write and hard
to bind in non-C languages.
• allow failing in a recoverable way.
• do not make the GL context creation API a mess of arguments.
Looking at prior art, it seems that a common pattern is to split the
construction phase in two:
• a first phase that creates a GL context wrapper object and
does preliminary checks on the environment.
• a second phase that creates the backend-specific GL object.
We adopted a similar pattern:
• gdk_window_create_gl_context() creates a GdkGLContext
• gdk_gl_context_realize() creates the underlying resources
Calling gdk_gl_context_make_current() also realizes the context, so
simple GL users do not need to care. Advanced users will want to
call gdk_window_create_gl_context(), set up the optional requirements,
and then call gdk_gl_context_realize(). If either of these two steps
fails, it's possible to recover by changing the requirements, or simply
creating a new GdkGLContext instance.
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-01-27 21:23:23 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (surface->gl_paint_context == NULL)
|
2019-04-06 16:36:51 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class = GDK_SURFACE_GET_CLASS (surface);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (class->create_gl_context == NULL)
|
2019-04-06 16:36:51 +00:00
|
|
|
|
{
|
|
|
|
|
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
|
|
|
|
_("The current backend does not support OpenGL"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
surface->gl_paint_context =
|
|
|
|
|
class->create_gl_context (surface, TRUE, NULL, &internal_error);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
}
|
GL: Split GL context creation in two phases
One of the major requests by OpenGL users has been the ability to
specify settings when creating a GL context, like the version to use
or whether the debug support should be enabled.
We have a couple of requirements in terms of API:
• avoid, if at all possible, the "C arrays of integers with
attribute, value pairs", which are hard to write and hard
to bind in non-C languages.
• allow failing in a recoverable way.
• do not make the GL context creation API a mess of arguments.
Looking at prior art, it seems that a common pattern is to split the
construction phase in two:
• a first phase that creates a GL context wrapper object and
does preliminary checks on the environment.
• a second phase that creates the backend-specific GL object.
We adopted a similar pattern:
• gdk_window_create_gl_context() creates a GdkGLContext
• gdk_gl_context_realize() creates the underlying resources
Calling gdk_gl_context_make_current() also realizes the context, so
simple GL users do not need to care. Advanced users will want to
call gdk_window_create_gl_context(), set up the optional requirements,
and then call gdk_gl_context_realize(). If either of these two steps
fails, it's possible to recover by changing the requirements, or simply
creating a new GdkGLContext instance.
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-01-27 21:23:23 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (internal_error != NULL)
|
|
|
|
|
{
|
|
|
|
|
g_propagate_error (error, internal_error);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
g_clear_object (&(surface->gl_paint_context));
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_gl_context_realize (surface->gl_paint_context, &internal_error);
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (internal_error != NULL)
|
|
|
|
|
{
|
|
|
|
|
g_propagate_error (error, internal_error);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
g_clear_object (&(surface->gl_paint_context));
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
return surface->gl_paint_context;
|
2014-10-09 08:45:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_create_gl_context:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @error: return location for an error
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #GdkGLContext matching the
|
|
|
|
|
* framebuffer format to the visual of the #GdkSurface. The context
|
|
|
|
|
* is disconnected from any particular surface or surface.
|
|
|
|
|
*
|
|
|
|
|
* If the creation of the #GdkGLContext failed, @error will be set.
|
|
|
|
|
*
|
|
|
|
|
* Before using the returned #GdkGLContext, you will need to
|
|
|
|
|
* call gdk_gl_context_make_current() or gdk_gl_context_realize().
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the newly created #GdkGLContext, or
|
|
|
|
|
* %NULL on error
|
|
|
|
|
**/
|
2014-10-09 08:45:44 +00:00
|
|
|
|
GdkGLContext *
|
2018-04-11 22:16:43 +00:00
|
|
|
|
gdk_surface_create_gl_context (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GError **error)
|
2014-10-09 08:45:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkGLContext *paint_context;
|
2014-10-09 08:45:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
|
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
2014-10-09 08:45:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
paint_context = gdk_surface_get_paint_gl_context (surface, error);
|
|
|
|
|
if (paint_context == NULL)
|
|
|
|
|
return NULL;
|
2014-10-09 08:45:44 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
return GDK_SURFACE_GET_CLASS (surface)->create_gl_context (surface,
|
|
|
|
|
FALSE,
|
|
|
|
|
paint_context,
|
|
|
|
|
error);
|
2018-04-11 22:16:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-12 14:48:31 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_create_cairo_context:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #GdkCairoContext for rendering on @surface.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the newly created #GdkCairoContext
|
|
|
|
|
**/
|
2018-04-11 22:16:43 +00:00
|
|
|
|
GdkCairoContext *
|
|
|
|
|
gdk_surface_create_cairo_context (GdkSurface *surface)
|
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDisplay *display;
|
2018-04-12 14:48:31 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2018-04-12 14:48:31 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2018-04-12 14:48:31 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->cairo_context_type,
|
|
|
|
|
"surface", surface,
|
|
|
|
|
NULL);
|
2014-10-09 08:45:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-28 15:34:01 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_create_vulkan_context:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @error: return location for an error
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #GdkVulkanContext for rendering on @surface.
|
|
|
|
|
*
|
|
|
|
|
* If the creation of the #GdkVulkanContext failed, @error will be set.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the newly created #GdkVulkanContext, or
|
|
|
|
|
* %NULL on error
|
|
|
|
|
**/
|
2016-11-28 15:34:01 +00:00
|
|
|
|
GdkVulkanContext *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_create_vulkan_context (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GError **error)
|
2016-11-28 15:34:01 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkDisplay *display;
|
2016-11-28 15:34:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
|
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
2016-11-28 15:34:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_DISPLAY_DEBUG_CHECK (surface->display, VULKAN_DISABLE))
|
|
|
|
|
{
|
|
|
|
|
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
|
|
|
|
_("Vulkan support disabled via GDK_DEBUG"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2016-11-29 14:35:04 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2016-11-28 15:34:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_DISPLAY_GET_CLASS (display)->vk_extension_name == NULL)
|
|
|
|
|
{
|
|
|
|
|
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
|
|
|
|
"The %s backend has no Vulkan support.", G_OBJECT_TYPE_NAME (display));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2016-11-28 15:34:01 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return g_initable_new (GDK_DISPLAY_GET_CLASS (display)->vk_context_type,
|
|
|
|
|
NULL,
|
|
|
|
|
error,
|
|
|
|
|
"surface", surface,
|
|
|
|
|
NULL);
|
2016-11-28 15:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-28 01:24:44 +00:00
|
|
|
|
/* Code for dirty-region queueing
|
2019-04-06 16:36:51 +00:00
|
|
|
|
*/
|
2018-03-20 14:14:10 +00:00
|
|
|
|
static GSList *update_surfaces = NULL;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_add_update_surface (GdkSurface *surface)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GSList *tmp;
|
2013-12-18 11:23:28 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* Check whether "surface" is already in "update_surfaces" list.
|
|
|
|
|
* It could be added during execution of gtk_widget_destroy() when
|
|
|
|
|
* setting focus widget to NULL and redrawing old focus widget.
|
|
|
|
|
* See bug 711552.
|
|
|
|
|
*/
|
|
|
|
|
tmp = g_slist_find (update_surfaces, surface);
|
|
|
|
|
if (tmp != NULL)
|
|
|
|
|
return;
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
update_surfaces = g_slist_prepend (update_surfaces, g_object_ref (surface));
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_remove_update_surface (GdkSurface *surface)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GSList *link;
|
2013-12-12 14:02:19 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
link = g_slist_find (update_surfaces, surface);
|
|
|
|
|
if (link != NULL)
|
|
|
|
|
{
|
|
|
|
|
update_surfaces = g_slist_delete_link (update_surfaces, link);
|
|
|
|
|
g_object_unref (surface);
|
|
|
|
|
}
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-09-12 17:13:24 +00:00
|
|
|
|
static gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_is_toplevel_frozen (GdkSurface *surface)
|
2007-09-12 17:13:24 +00:00
|
|
|
|
{
|
2019-03-22 18:24:39 +00:00
|
|
|
|
return surface->update_and_descendants_freeze_count > 0;
|
2007-09-12 17:13:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-08-26 14:09:08 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_schedule_update (GdkSurface *surface)
|
2004-08-26 14:09:08 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkFrameClock *frame_clock;
|
2013-01-30 20:09:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface &&
|
|
|
|
|
(surface->update_freeze_count ||
|
|
|
|
|
gdk_surface_is_toplevel_frozen (surface)))
|
|
|
|
|
return;
|
2004-08-26 14:09:08 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* If there's no frame clock (a foreign surface), then the invalid
|
|
|
|
|
* region will just stick around unless gdk_surface_process_updates()
|
|
|
|
|
* is called. */
|
|
|
|
|
frame_clock = gdk_surface_get_frame_clock (surface);
|
|
|
|
|
if (frame_clock)
|
|
|
|
|
gdk_frame_clock_request_phase (gdk_surface_get_frame_clock (surface),
|
|
|
|
|
GDK_FRAME_CLOCK_PHASE_PAINT);
|
2004-08-26 14:09:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-28 01:24:44 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_process_updates_internal (GdkSurface *surface)
|
2000-03-28 01:24:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* Ensure the surface lives while updating it */
|
|
|
|
|
g_object_ref (surface);
|
2009-08-20 15:09:08 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->in_update = TRUE;
|
2013-04-17 21:06:07 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* If an update got queued during update processing, we can get a
|
|
|
|
|
* surface in the update queue that has an empty update_area.
|
|
|
|
|
* just ignore it.
|
|
|
|
|
*/
|
|
|
|
|
if (surface->update_area)
|
|
|
|
|
{
|
|
|
|
|
g_assert (surface->active_update_area == NULL); /* No reentrancy */
|
2014-10-09 08:09:51 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->active_update_area = surface->update_area;
|
|
|
|
|
surface->update_area = NULL;
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (gdk_surface_is_viewable (surface))
|
|
|
|
|
{
|
|
|
|
|
cairo_region_t *expose_region;
|
2019-03-23 13:35:14 +00:00
|
|
|
|
gboolean handled;
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
expose_region = cairo_region_copy (surface->active_update_area);
|
2014-10-09 08:09:51 +00:00
|
|
|
|
|
2019-03-23 13:35:14 +00:00
|
|
|
|
g_signal_emit (surface, signals[RENDER], 0, expose_region, &handled);
|
2014-06-21 22:03:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_destroy (expose_region);
|
|
|
|
|
}
|
2014-10-09 08:09:51 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_destroy (surface->active_update_area);
|
|
|
|
|
surface->active_update_area = NULL;
|
|
|
|
|
}
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->in_update = FALSE;
|
2013-04-17 21:06:07 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_object_unref (surface);
|
2000-03-28 01:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-30 16:46:22 +00:00
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_paint_on_clock (GdkFrameClock *clock,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
void *data)
|
2013-06-26 08:03:51 +00:00
|
|
|
|
{
|
2019-05-22 20:58:24 +00:00
|
|
|
|
GdkSurface *surface = GDK_SURFACE (data);
|
|
|
|
|
GList *l;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-10-21 21:42:39 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
return;
|
2009-08-20 15:09:08 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_object_ref (surface);
|
2009-09-14 11:24:55 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->update_area &&
|
|
|
|
|
!surface->update_freeze_count &&
|
|
|
|
|
!gdk_surface_is_toplevel_frozen (surface) &&
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* Don't recurse into process_updates_internal, we'll
|
|
|
|
|
* do the update later when idle instead. */
|
|
|
|
|
!surface->in_update)
|
|
|
|
|
{
|
|
|
|
|
gdk_surface_process_updates_internal (surface);
|
|
|
|
|
gdk_surface_remove_update_surface (surface);
|
|
|
|
|
}
|
2009-08-20 15:09:08 +00:00
|
|
|
|
|
2019-05-22 20:58:24 +00:00
|
|
|
|
for (l = surface->children; l; l = l->next)
|
|
|
|
|
gdk_surface_paint_on_clock (clock, l->data);
|
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_object_unref (surface);
|
2000-03-28 01:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-21 03:07:37 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_invalidate_rect:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
|
|
|
|
|
* surface
|
|
|
|
|
*
|
|
|
|
|
* A convenience wrapper around gdk_surface_invalidate_region() which
|
|
|
|
|
* invalidates a rectangular region. See
|
|
|
|
|
* gdk_surface_invalidate_region() for details.
|
|
|
|
|
**/
|
2018-03-21 03:07:37 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_surface_invalidate_rect (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
const GdkRectangle *rect)
|
2000-03-28 01:24:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkRectangle surface_rect;
|
|
|
|
|
cairo_region_t *region;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
return;
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
if (!surface->viewable)
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return;
|
2000-07-31 17:18:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (!rect)
|
|
|
|
|
{
|
|
|
|
|
surface_rect.x = 0;
|
|
|
|
|
surface_rect.y = 0;
|
|
|
|
|
surface_rect.width = surface->width;
|
|
|
|
|
surface_rect.height = surface->height;
|
|
|
|
|
rect = &surface_rect;
|
|
|
|
|
}
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
region = cairo_region_create_rectangle (rect);
|
|
|
|
|
gdk_surface_invalidate_region (surface, region);
|
|
|
|
|
cairo_region_destroy (region);
|
2000-03-28 01:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-14 11:28:38 +00:00
|
|
|
|
static void
|
2018-03-28 14:42:26 +00:00
|
|
|
|
impl_surface_add_update_area (GdkSurface *impl_surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_t *region)
|
2009-09-14 11:28:38 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (impl_surface->update_area)
|
|
|
|
|
cairo_region_union (impl_surface->update_area, region);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gdk_surface_add_update_surface (impl_surface);
|
|
|
|
|
impl_surface->update_area = cairo_region_copy (region);
|
|
|
|
|
gdk_surface_schedule_update (impl_surface);
|
|
|
|
|
}
|
2009-09-14 11:28:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-28 14:42:26 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_queue_expose:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Forces an expose event for @surface to be scheduled.
|
|
|
|
|
*
|
|
|
|
|
* If the invalid area of @surface is empty, an expose event will
|
|
|
|
|
* still be emitted. Its invalid region will be empty.
|
|
|
|
|
*
|
|
|
|
|
* This function is useful for implementations that track invalid
|
|
|
|
|
* regions on their own.
|
|
|
|
|
**/
|
2018-03-28 14:42:26 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_surface_queue_expose (GdkSurface *surface)
|
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_t *region;
|
2018-03-28 14:42:26 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2018-03-28 14:42:26 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
region = cairo_region_create ();
|
|
|
|
|
impl_surface_add_update_area (surface, region);
|
|
|
|
|
cairo_region_destroy (region);
|
2018-03-28 14:42:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-21 03:07:37 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_invalidate_region:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @region: a #cairo_region_t
|
|
|
|
|
*
|
|
|
|
|
* Adds @region to the update area for @surface. The update area is the
|
|
|
|
|
* region that needs to be redrawn, or “dirty region.”
|
|
|
|
|
*
|
|
|
|
|
* GDK will process all updates whenever the frame clock schedules a redraw,
|
|
|
|
|
* so there’s no need to do forces redraws manually, you just need to
|
|
|
|
|
* invalidate regions that you know should be redrawn.
|
|
|
|
|
**/
|
2018-03-21 03:07:37 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_surface_invalidate_region (GdkSurface *surface,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
const cairo_region_t *region)
|
2000-03-28 01:24:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_t *visible_region;
|
|
|
|
|
cairo_rectangle_int_t r;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2009-05-27 15:08:09 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
return;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
if (!surface->viewable || cairo_region_is_empty (region))
|
2019-04-06 16:36:51 +00:00
|
|
|
|
return;
|
2013-04-20 23:27:07 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
r.x = 0;
|
|
|
|
|
r.y = 0;
|
2019-03-23 13:13:37 +00:00
|
|
|
|
r.width = surface->width;
|
|
|
|
|
r.height = surface->height;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
visible_region = cairo_region_copy (region);
|
2009-05-27 15:08:09 +00:00
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
cairo_region_intersect_rectangle (visible_region, &r);
|
|
|
|
|
impl_surface_add_update_area (surface, visible_region);
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_destroy (visible_region);
|
2000-03-28 01:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-15 16:09:53 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* _gdk_surface_clear_update_area:
|
|
|
|
|
* @surface: a #GdkSurface.
|
|
|
|
|
*
|
|
|
|
|
* Internal function to clear the update area for a surface. This
|
|
|
|
|
* is called when the surface is hidden or destroyed.
|
|
|
|
|
**/
|
2000-05-15 16:09:53 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_clear_update_area (GdkSurface *surface)
|
2000-05-15 16:09:53 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2000-05-15 16:09:53 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (surface->update_area)
|
|
|
|
|
{
|
|
|
|
|
gdk_surface_remove_update_surface (surface);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
cairo_region_destroy (surface->update_area);
|
|
|
|
|
surface->update_area = NULL;
|
|
|
|
|
}
|
2000-05-15 16:09:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_freeze_updates:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Temporarily freezes a surface such that it won’t receive expose
|
|
|
|
|
* events. The surface will begin receiving expose events again when
|
|
|
|
|
* gdk_surface_thaw_updates() is called. If gdk_surface_freeze_updates()
|
|
|
|
|
* has been called more than once, gdk_surface_thaw_updates() must be called
|
|
|
|
|
* an equal number of times to begin processing exposes.
|
|
|
|
|
**/
|
2000-03-28 01:24:44 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_freeze_updates (GdkSurface *surface)
|
2000-03-28 01:24:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
surface->update_freeze_count++;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_thaw_updates:
|
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
*
|
|
|
|
|
* Thaws a surface frozen with gdk_surface_freeze_updates().
|
|
|
|
|
**/
|
2000-03-28 01:24:44 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_thaw_updates (GdkSurface *surface)
|
2000-03-28 01:24:44 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
g_return_if_fail (surface->update_freeze_count > 0);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (--surface->update_freeze_count == 0)
|
|
|
|
|
gdk_surface_schedule_update (surface);
|
2000-03-28 01:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-07 14:33:53 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_freeze_toplevel_updates (GdkSurface *surface)
|
2007-09-12 17:13:24 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2007-09-12 17:13:24 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->update_and_descendants_freeze_count++;
|
|
|
|
|
_gdk_frame_clock_freeze (gdk_surface_get_frame_clock (surface));
|
2007-09-12 17:13:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-07 14:33:53 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_thaw_toplevel_updates (GdkSurface *surface)
|
2007-09-12 17:13:24 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
|
|
|
|
g_return_if_fail (surface->update_and_descendants_freeze_count > 0);
|
2007-09-12 17:13:24 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
surface->update_and_descendants_freeze_count--;
|
|
|
|
|
_gdk_frame_clock_thaw (gdk_surface_get_frame_clock (surface));
|
2007-09-12 17:13:24 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
gdk_surface_schedule_update (surface);
|
2007-09-12 17:13:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
/**
|
2019-04-06 16:36:51 +00:00
|
|
|
|
* gdk_surface_constrain_size:
|
|
|
|
|
* @geometry: a #GdkGeometry structure
|
|
|
|
|
* @flags: a mask indicating what portions of @geometry are set
|
|
|
|
|
* @width: desired width of surface
|
|
|
|
|
* @height: desired height of the surface
|
|
|
|
|
* @new_width: (out): location to store resulting width
|
|
|
|
|
* @new_height: (out): location to store resulting height
|
|
|
|
|
*
|
|
|
|
|
* Constrains a desired width and height according to a
|
|
|
|
|
* set of geometry hints (such as minimum and maximum size).
|
|
|
|
|
*/
|
2001-03-29 21:17:45 +00:00
|
|
|
|
void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_constrain_size (GdkGeometry *geometry,
|
2019-04-06 16:36:51 +00:00
|
|
|
|
GdkSurfaceHints flags,
|
|
|
|
|
gint width,
|
|
|
|
|
gint height,
|
|
|
|
|
gint *new_width,
|
|
|
|
|
gint *new_height)
|
|
|
|
|
{
|
|
|
|
|
/* This routine is partially borrowed from fvwm.
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1993, Robert Nation
|
|
|
|
|
* You may use this code for any purpose, as long as the original
|
|
|
|
|
* copyright remains in the source code and all documentation
|
|
|
|
|
*
|
|
|
|
|
* which in turn borrows parts of the algorithm from uwm
|
|
|
|
|
*/
|
|
|
|
|
gint min_width = 0;
|
|
|
|
|
gint min_height = 0;
|
|
|
|
|
gint base_width = 0;
|
|
|
|
|
gint base_height = 0;
|
|
|
|
|
gint xinc = 1;
|
|
|
|
|
gint yinc = 1;
|
|
|
|
|
gint max_width = G_MAXINT;
|
|
|
|
|
gint max_height = G_MAXINT;
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2018-03-21 08:06:31 +00:00
|
|
|
|
#define FLOOR(value, base) ( ((gint) ((value) / (base))) * (base) )
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if ((flags & GDK_HINT_BASE_SIZE) && (flags & GDK_HINT_MIN_SIZE))
|
|
|
|
|
{
|
|
|
|
|
base_width = geometry->base_width;
|
|
|
|
|
base_height = geometry->base_height;
|
|
|
|
|
min_width = geometry->min_width;
|
|
|
|
|
min_height = geometry->min_height;
|
|
|
|
|
}
|
|
|
|
|
else if (flags & GDK_HINT_BASE_SIZE)
|
|
|
|
|
{
|
|
|
|
|
base_width = geometry->base_width;
|
|
|
|
|
base_height = geometry->base_height;
|
|
|
|
|
min_width = geometry->base_width;
|
|
|
|
|
min_height = geometry->base_height;
|
|
|
|
|
}
|
|
|
|
|
else if (flags & GDK_HINT_MIN_SIZE)
|
|
|
|
|
{
|
|
|
|
|
base_width = geometry->min_width;
|
|
|
|
|
base_height = geometry->min_height;
|
|
|
|
|
min_width = geometry->min_width;
|
|
|
|
|
min_height = geometry->min_height;
|
|
|
|
|
}
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (flags & GDK_HINT_MAX_SIZE)
|
|
|
|
|
{
|
|
|
|
|
max_width = geometry->max_width ;
|
|
|
|
|
max_height = geometry->max_height;
|
|
|
|
|
}
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
if (flags & GDK_HINT_RESIZE_INC)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
xinc = MAX (xinc, geometry->width_inc);
|
|
|
|
|
yinc = MAX (yinc, geometry->height_inc);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
2019-03-25 12:33:56 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
/* clamp width and height to min and max values
|
|
|
|
|
*/
|
|
|
|
|
width = CLAMP (width, min_width, max_width);
|
|
|
|
|
height = CLAMP (height, min_height, max_height);
|
|
|
|
|
|
|
|
|
|
/* shrink to base + N * inc
|
|
|
|
|
*/
|
|
|
|
|
width = base_width + FLOOR (width - base_width, xinc);
|
|
|
|
|
height = base_height + FLOOR (height - base_height, yinc);
|
|
|
|
|
|
|
|
|
|
/* constrain aspect ratio, according to:
|
|
|
|
|
*
|
|
|
|
|
* width
|
|
|
|
|
* min_aspect <= -------- <= max_aspect
|
|
|
|
|
* height
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (flags & GDK_HINT_ASPECT &&
|
|
|
|
|
geometry->min_aspect > 0 &&
|
|
|
|
|
geometry->max_aspect > 0)
|
2019-03-25 12:33:56 +00:00
|
|
|
|
{
|
2019-04-06 16:36:51 +00:00
|
|
|
|
gint delta;
|
|
|
|
|
|
|
|
|
|
if (geometry->min_aspect * height > width)
|
|
|
|
|
{
|
|
|
|
|
delta = FLOOR (height - width / geometry->min_aspect, yinc);
|
|
|
|
|
if (height - delta >= min_height)
|
|
|
|
|
height -= delta;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
delta = FLOOR (height * geometry->min_aspect - width, xinc);
|
|
|
|
|
if (width + delta <= max_width)
|
|
|
|
|
width += delta;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (geometry->max_aspect * height < width)
|
|
|
|
|
{
|
|
|
|
|
delta = FLOOR (width - height * geometry->max_aspect, xinc);
|
|
|
|
|
if (width - delta >= min_width)
|
|
|
|
|
width -= delta;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
delta = FLOOR (width / geometry->max_aspect - height, yinc);
|
|
|
|
|
if (height + delta <= max_height)
|
|
|
|
|
height += delta;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-25 12:33:56 +00:00
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
|
|
|
|
#undef FLOOR
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-04-06 16:36:51 +00:00
|
|
|
|
*new_width = width;
|
|
|
|
|
*new_height = height;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
2001-07-05 13:41:34 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
/**
|
2019-03-25 14:12:01 +00:00
|
|
|
|
* gdk_surface_get_device_position:
|
|
|
|
|
* @surface: a #GdkSurface.
|
|
|
|
|
* @device: pointer #GdkDevice to query to.
|
|
|
|
|
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
|
|
|
|
|
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
|
|
|
|
|
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
|
|
|
|
|
*
|
|
|
|
|
* Obtains the current device position in doubles and modifier state.
|
|
|
|
|
* The position is given in coordinates relative to the upper left
|
|
|
|
|
* corner of @surface.
|
|
|
|
|
**/
|
2019-04-19 19:39:23 +00:00
|
|
|
|
void
|
2019-03-25 14:12:01 +00:00
|
|
|
|
gdk_surface_get_device_position (GdkSurface *surface,
|
|
|
|
|
GdkDevice *device,
|
|
|
|
|
double *x,
|
|
|
|
|
double *y,
|
|
|
|
|
GdkModifierType *mask)
|
|
|
|
|
{
|
|
|
|
|
gdouble tmp_x, tmp_y;
|
|
|
|
|
GdkModifierType tmp_mask;
|
|
|
|
|
|
2019-04-19 19:39:23 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
|
|
|
|
g_return_if_fail (GDK_IS_DEVICE (device));
|
|
|
|
|
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
|
2019-03-25 14:12:01 +00:00
|
|
|
|
|
|
|
|
|
tmp_x = tmp_y = 0;
|
|
|
|
|
tmp_mask = 0;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->get_device_state (surface,
|
|
|
|
|
device,
|
|
|
|
|
&tmp_x, &tmp_y,
|
|
|
|
|
&tmp_mask);
|
2019-03-24 19:42:32 +00:00
|
|
|
|
|
2019-03-25 14:12:01 +00:00
|
|
|
|
if (x)
|
|
|
|
|
*x = tmp_x;
|
|
|
|
|
if (y)
|
|
|
|
|
*y = tmp_y;
|
|
|
|
|
if (mask)
|
|
|
|
|
*mask = tmp_mask;
|
2013-07-03 09:52:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_raise_internal (GdkSurface *surface)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->raise (surface);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* Returns TRUE If the native surface was mapped or unmapped */
|
2009-08-11 09:30:55 +00:00
|
|
|
|
static gboolean
|
2018-03-20 10:40:08 +00:00
|
|
|
|
set_viewable (GdkSurface *w,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean val)
|
2009-07-18 18:29:50 +00:00
|
|
|
|
{
|
2009-08-11 09:30:55 +00:00
|
|
|
|
if (w->viewable == val)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2009-07-18 18:29:50 +00:00
|
|
|
|
w->viewable = val;
|
|
|
|
|
|
2009-08-11 09:30:55 +00:00
|
|
|
|
return FALSE;
|
2009-07-18 18:29:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-11 09:30:55 +00:00
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_update_viewable (GdkSurface *surface)
|
2009-07-18 18:29:50 +00:00
|
|
|
|
{
|
2019-03-23 12:43:07 +00:00
|
|
|
|
return set_viewable (surface, GDK_SURFACE_IS_MAPPED (surface));
|
2009-07-18 18:29:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2019-03-24 19:42:32 +00:00
|
|
|
|
gboolean was_mapped;
|
2019-03-23 13:13:37 +00:00
|
|
|
|
gboolean did_show;
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
if (raise)
|
2019-03-23 13:13:37 +00:00
|
|
|
|
gdk_surface_raise_internal (surface);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-03-24 19:26:55 +00:00
|
|
|
|
if (!was_mapped)
|
|
|
|
|
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
did_show = _gdk_surface_update_viewable (surface);
|
2009-07-18 18:29:50 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->show (surface, !did_show ? was_mapped : TRUE);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
if (!was_mapped)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (gdk_surface_is_viewable (surface))
|
2018-03-21 03:07:37 +00:00
|
|
|
|
gdk_surface_invalidate_rect (surface, NULL);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-26 18:53:48 +00:00
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_show_unraised:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Shows a #GdkSurface onscreen, but does not modify its stacking
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* order. In contrast, gdk_surface_show() will raise the surface
|
|
|
|
|
* to the top of the surface stack.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
|
|
|
|
* On the X11 platform, in Xlib terms, this function calls
|
|
|
|
|
* XMapWindow() (it also updates some internal GDK state, which means
|
2018-03-20 11:05:26 +00:00
|
|
|
|
* that you can’t really use XMapWindow() directly on a GDK surface).
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_show_unraised (GdkSurface *surface)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_show_internal (surface, FALSE);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_raise:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Raises @surface to the top of the Z-order (stacking order), so that
|
|
|
|
|
* other surfaces with the same parent surface appear below @surface.
|
|
|
|
|
* This is true whether or not the surfaces are visible.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-07-15 19:36:19 +00:00
|
|
|
|
* If @surface is a toplevel, the window manager may choose to deny the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* request to move the surface in the Z-order, gdk_surface_raise() only
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* requests the restack, does not guarantee it.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_raise (GdkSurface *surface)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-03-23 12:43:07 +00:00
|
|
|
|
gdk_surface_raise_internal (surface);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_lower_internal (GdkSurface *surface)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->lower (surface);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_lower:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Lowers @surface to the bottom of the Z-order (stacking order), so that
|
|
|
|
|
* other surfaces with the same parent surface appear above @surface.
|
|
|
|
|
* This is true whether or not the other surfaces are visible.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If @surface is a toplevel, the window manager may choose to deny the
|
|
|
|
|
* request to move the surface in the Z-order, gdk_surface_lower() only
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* requests the restack, does not guarantee it.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Note that gdk_surface_show() raises the surface again, so don’t call this
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* function before gdk_surface_show(). (Try gdk_surface_show_unraised().)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_lower (GdkSurface *surface)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Keep children in (reverse) stacking order */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_lower_internal (surface);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-02 21:38:55 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_restack:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @sibling: (allow-none): a #GdkSurface that is a sibling of @surface, or %NULL
|
2009-09-02 21:38:55 +00:00
|
|
|
|
* @above: a boolean
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Changes the position of @surface in the Z-order (stacking order), so that
|
2009-09-02 21:38:55 +00:00
|
|
|
|
* it is above @sibling (if @above is %TRUE) or below @sibling (if @above is
|
|
|
|
|
* %FALSE).
|
|
|
|
|
*
|
|
|
|
|
* If @sibling is %NULL, then this either raises (if @above is %TRUE) or
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* lowers the surface.
|
2009-09-02 21:38:55 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If @surface is a toplevel, the window manager may choose to deny the
|
|
|
|
|
* request to move the surface in the Z-order, gdk_surface_restack() only
|
2009-09-02 21:38:55 +00:00
|
|
|
|
* requests the restack, does not guarantee it.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_restack (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkSurface *sibling,
|
|
|
|
|
gboolean above)
|
2009-09-02 21:38:55 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2018-03-20 10:40:08 +00:00
|
|
|
|
g_return_if_fail (sibling == NULL || GDK_IS_SURFACE (sibling));
|
2009-09-02 21:38:55 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2009-09-02 21:38:55 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (sibling == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (above)
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gdk_surface_raise (surface);
|
2009-09-02 21:38:55 +00:00
|
|
|
|
else
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gdk_surface_lower (surface);
|
2009-09-02 21:38:55 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->restack_toplevel (surface, sibling, above);
|
2009-09-02 21:38:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 21:31:33 +00:00
|
|
|
|
static void
|
|
|
|
|
grab_prepare_func (GdkSeat *seat,
|
|
|
|
|
GdkSurface *surface,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
gdk_surface_show_internal (surface, TRUE);
|
|
|
|
|
}
|
2009-09-02 21:38:55 +00:00
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_show:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Like gdk_surface_show_unraised(), but also raises the surface to the
|
|
|
|
|
* top of the surface stack (moves the surface to the front of the
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* Z-order).
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function maps a surface so it’s visible onscreen. Its opposite
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* is gdk_surface_hide().
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
|
|
|
|
* When implementing a #GtkWidget, you should call this function on the widget's
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* #GdkSurface as part of the “map” method.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_show (GdkSurface *surface)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2019-04-22 21:31:33 +00:00
|
|
|
|
if (surface->autohide)
|
|
|
|
|
{
|
|
|
|
|
gdk_seat_grab (gdk_display_get_default_seat (surface->display),
|
|
|
|
|
surface,
|
|
|
|
|
GDK_SEAT_CAPABILITY_ALL,
|
|
|
|
|
TRUE,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
grab_prepare_func, NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gdk_surface_show_internal (surface, TRUE);
|
|
|
|
|
}
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_hide:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* For toplevel surfaces, withdraws them, so they will no longer be
|
|
|
|
|
* known to the window manager; for all surfaces, unmaps them, so
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* they won’t be displayed. Normally done automatically as
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* part of gtk_widget_hide().
|
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_hide (GdkSurface *surface)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2019-03-24 19:42:32 +00:00
|
|
|
|
gboolean was_mapped;
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2019-03-24 19:26:55 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_WITHDRAWN);
|
2017-05-14 19:30:16 +00:00
|
|
|
|
|
|
|
|
|
if (was_mapped)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
2016-10-26 10:21:39 +00:00
|
|
|
|
GdkSeat *seat;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GList *devices, *d;
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
|
|
|
|
/* May need to break grabs on children */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2016-10-26 10:21:39 +00:00
|
|
|
|
seat = gdk_display_get_default_seat (display);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2016-10-26 14:45:04 +00:00
|
|
|
|
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
2016-10-26 10:21:39 +00:00
|
|
|
|
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
|
|
|
|
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
for (d = devices; d; d = d->next)
|
|
|
|
|
{
|
|
|
|
|
GdkDevice *device = d->data;
|
|
|
|
|
|
2010-12-13 19:05:59 +00:00
|
|
|
|
if (_gdk_display_end_device_grab (display,
|
|
|
|
|
device,
|
|
|
|
|
_gdk_display_get_next_serial (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
TRUE))
|
2016-10-26 22:06:36 +00:00
|
|
|
|
{
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
gdk_device_ungrab (device, GDK_CURRENT_TIME);
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
}
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
g_list_free (devices);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->hide (surface);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-20 22:03:16 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_resize_toplevel (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean with_move,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gint width,
|
|
|
|
|
gint height)
|
2009-01-20 22:03:16 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->move_resize (surface, with_move, x, y, width, height);
|
2009-01-20 22:03:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_resize_internal (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean with_move,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gint width,
|
|
|
|
|
gint height)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-03-23 12:43:07 +00:00
|
|
|
|
gdk_surface_move_resize_toplevel (surface, with_move, x, y, width, height);
|
2018-07-15 14:45:57 +00:00
|
|
|
|
}
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2018-07-15 23:52:28 +00:00
|
|
|
|
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_move:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @x: X coordinate relative to surface’s parent
|
|
|
|
|
* @y: Y coordinate relative to surface’s parent
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Repositions a surface relative to its parent surface.
|
|
|
|
|
* For toplevel surfaces, window managers may ignore or modify the move;
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* you should probably use gtk_window_move() on a #GtkWindow widget
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* anyway, instead of using GDK functions. For child surfaces,
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* the move will reliably succeed.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If you’re also planning to resize the surface, use gdk_surface_move_resize()
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* to both move and resize simultaneously, for a nicer visual effect.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_resize_internal (surface, TRUE, x, y, -1, -1);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_resize:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @width: new width of the surface
|
|
|
|
|
* @height: new height of the surface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Resizes @surface; for toplevel surfaces, asks the window manager to resize
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* the surface. The window manager may not allow the resize. When using GTK,
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* use gtk_window_resize() instead of this low-level GDK function.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Surfaces may not be resized below 1x1.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If you’re also planning to move the surface, use gdk_surface_move_resize()
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* to both move and resize simultaneously, for a nicer visual effect.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_resize (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint width,
|
|
|
|
|
gint height)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_resize_internal (surface, FALSE, 0, 0, width, height);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_move_resize:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @x: new X position relative to surface’s parent
|
|
|
|
|
* @y: new Y position relative to surface’s parent
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* @width: new width
|
|
|
|
|
* @height: new height
|
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Equivalent to calling gdk_surface_move() and gdk_surface_resize(),
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* except that both operations are performed at once, avoiding strange
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* visual effects. (i.e. the user may be able to see the surface first
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* move, then resize, if you don’t use gdk_surface_move_resize().)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_resize (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gint width,
|
|
|
|
|
gint height)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_resize_internal (surface, TRUE, x, y, width, height);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-15 15:00:38 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_move_to_rect:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: the #GdkSurface to move
|
|
|
|
|
* @rect: (not nullable): the destination #GdkRectangle to align @surface with
|
|
|
|
|
* @rect_anchor: the point on @rect to align with @surface's anchor point
|
|
|
|
|
* @surface_anchor: the point on @surface to align with @rect's anchor point
|
2016-06-15 15:00:38 +00:00
|
|
|
|
* @anchor_hints: positioning hints to use when limited on space
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @rect_anchor_dx: horizontal offset to shift @surface, i.e. @rect's anchor
|
2016-06-15 15:00:38 +00:00
|
|
|
|
* point
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @rect_anchor_dy: vertical offset to shift @surface, i.e. @rect's anchor point
|
2016-06-15 15:00:38 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Moves @surface to @rect, aligning their anchor points.
|
2016-06-15 15:00:38 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @rect is relative to the top-left corner of the surface that @surface is
|
2018-03-20 11:05:26 +00:00
|
|
|
|
* transient for. @rect_anchor and @surface_anchor determine anchor points on
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @rect and @surface to pin together. @rect's anchor point can optionally be
|
2016-06-15 15:00:38 +00:00
|
|
|
|
* offset by @rect_anchor_dx and @rect_anchor_dy, which is equivalent to
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* offsetting the position of @surface.
|
2016-06-15 15:00:38 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @anchor_hints determines how @surface will be moved if the anchor points cause
|
2016-06-15 15:00:38 +00:00
|
|
|
|
* it to move off-screen. For example, %GDK_ANCHOR_FLIP_X will replace
|
|
|
|
|
* %GDK_GRAVITY_NORTH_WEST with %GDK_GRAVITY_NORTH_EAST and vice versa if
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface extends beyond the left or right edges of the monitor.
|
2016-06-15 15:00:38 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Connect to the #GdkSurface::moved-to-rect signal to find out how it was
|
2016-06-15 15:00:38 +00:00
|
|
|
|
* actually positioned.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_move_to_rect (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
const GdkRectangle *rect,
|
|
|
|
|
GdkGravity rect_anchor,
|
|
|
|
|
GdkGravity surface_anchor,
|
|
|
|
|
GdkAnchorHints anchor_hints,
|
|
|
|
|
gint rect_anchor_dx,
|
|
|
|
|
gint rect_anchor_dy)
|
2016-06-15 15:00:38 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2019-04-22 15:17:53 +00:00
|
|
|
|
g_return_if_fail (surface->parent || surface->transient_for);
|
2016-06-15 15:00:38 +00:00
|
|
|
|
g_return_if_fail (rect);
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->move_to_rect (surface,
|
|
|
|
|
rect,
|
|
|
|
|
rect_anchor,
|
|
|
|
|
surface_anchor,
|
|
|
|
|
anchor_hints,
|
|
|
|
|
rect_anchor_dx,
|
|
|
|
|
rect_anchor_dy);
|
2016-06-15 15:00:38 +00:00
|
|
|
|
}
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_cursor_internal (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GdkCursor *cursor)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-06-25 22:47:40 +00:00
|
|
|
|
GdkPointerSurfaceInfo *pointer_info;
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2011-05-03 22:01:10 +00:00
|
|
|
|
return;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-06-25 22:47:40 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2019-03-23 13:13:37 +00:00
|
|
|
|
|
|
|
|
|
g_assert (display == gdk_device_get_display (device));
|
|
|
|
|
|
2018-06-25 22:47:40 +00:00
|
|
|
|
pointer_info = _gdk_display_get_pointer_info (display, device);
|
2011-05-03 22:01:10 +00:00
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
if (surface == pointer_info->surface_under_pointer)
|
2018-06-25 22:47:40 +00:00
|
|
|
|
update_cursor (display, device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-07-16 06:16:01 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_cursor:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2009-07-16 06:16:01 +00:00
|
|
|
|
*
|
|
|
|
|
* Retrieves a #GdkCursor pointer for the cursor currently set on the
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* specified #GdkSurface, or %NULL. If the return value is %NULL then
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* there is no custom cursor set on the specified surface, and it is
|
|
|
|
|
* using the cursor for its parent surface.
|
2009-07-16 06:16:01 +00:00
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): a #GdkCursor, or %NULL. The
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* returned object is owned by the #GdkSurface and should not be
|
|
|
|
|
* unreferenced directly. Use gdk_surface_set_cursor() to unset the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* cursor of the surface
|
2009-07-16 06:16:01 +00:00
|
|
|
|
*/
|
|
|
|
|
GdkCursor *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_cursor (GdkSurface *surface)
|
2009-07-16 06:16:01 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2009-07-16 06:16:01 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->cursor;
|
2009-07-16 06:16:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_cursor:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2010-06-27 14:39:02 +00:00
|
|
|
|
* @cursor: (allow-none): a cursor
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Sets the default mouse pointer for a #GdkSurface.
|
2014-10-28 04:44:33 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Note that @cursor must be for the same display as @surface.
|
2014-10-28 04:44:33 +00:00
|
|
|
|
*
|
2018-07-13 08:06:10 +00:00
|
|
|
|
* Use gdk_cursor_new_from_name() or gdk_cursor_new_from_texture() to
|
2014-10-28 04:44:33 +00:00
|
|
|
|
* create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Passing %NULL for the @cursor argument to gdk_surface_set_cursor() means
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* that @surface will use the cursor of its parent surface. Most surfaces
|
2014-10-28 04:44:33 +00:00
|
|
|
|
* should use this default.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_cursor (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkCursor *cursor)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2008-12-15 13:02:52 +00:00
|
|
|
|
GdkDisplay *display;
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->cursor)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_object_unref (surface->cursor);
|
|
|
|
|
surface->cursor = NULL;
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!GDK_SURFACE_DESTROYED (surface))
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2015-12-15 22:20:40 +00:00
|
|
|
|
GdkDevice *device;
|
|
|
|
|
GList *seats, *s;
|
2011-05-03 22:01:10 +00:00
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
if (cursor)
|
2018-03-21 08:06:31 +00:00
|
|
|
|
surface->cursor = g_object_ref (cursor);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2015-12-15 22:20:40 +00:00
|
|
|
|
seats = gdk_display_list_seats (display);
|
2011-05-03 22:01:10 +00:00
|
|
|
|
|
2015-12-15 22:20:40 +00:00
|
|
|
|
for (s = seats; s; s = s->next)
|
2011-05-03 22:01:10 +00:00
|
|
|
|
{
|
2017-07-25 13:37:10 +00:00
|
|
|
|
GList *devices, *d;
|
|
|
|
|
|
2015-12-15 22:20:40 +00:00
|
|
|
|
device = gdk_seat_get_pointer (s->data);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_cursor_internal (surface, device, surface->cursor);
|
2017-07-25 13:37:10 +00:00
|
|
|
|
|
|
|
|
|
devices = gdk_seat_get_slaves (s->data, GDK_SEAT_CAPABILITY_TABLET_STYLUS);
|
|
|
|
|
for (d = devices; d; d = d->next)
|
|
|
|
|
{
|
|
|
|
|
device = gdk_device_get_associated_device (d->data);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_cursor_internal (surface, device, surface->cursor);
|
2017-07-25 13:37:10 +00:00
|
|
|
|
}
|
|
|
|
|
g_list_free (devices);
|
2011-05-03 22:01:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-15 22:20:40 +00:00
|
|
|
|
g_list_free (seats);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_CURSOR]);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
}
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_device_cursor:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface.
|
2010-12-20 22:04:44 +00:00
|
|
|
|
* @device: a master, pointer #GdkDevice.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Retrieves a #GdkCursor pointer for the @device currently set on the
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* specified #GdkSurface, or %NULL. If the return value is %NULL then
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* there is no custom cursor set on the specified surface, and it is
|
|
|
|
|
* using the cursor for its parent surface.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): a #GdkCursor, or %NULL. The
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* returned object is owned by the #GdkSurface and should not be
|
|
|
|
|
* unreferenced directly. Use gdk_surface_set_cursor() to unset the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* cursor of the surface
|
2010-05-25 22:38:44 +00:00
|
|
|
|
**/
|
|
|
|
|
GdkCursor *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_device_cursor (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkDevice *device)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
2010-12-20 22:04:44 +00:00
|
|
|
|
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
|
|
|
|
|
g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER, NULL);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return g_hash_table_lookup (surface->device_cursor, device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_device_cursor:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2010-12-20 22:04:44 +00:00
|
|
|
|
* @device: a master, pointer #GdkDevice
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* @cursor: a #GdkCursor
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Sets a specific #GdkCursor for a given device when it gets inside @surface.
|
2018-07-13 08:06:10 +00:00
|
|
|
|
* Use gdk_cursor_new_fromm_name() or gdk_cursor_new_from_texture() to create
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. Passing
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* %NULL for the @cursor argument to gdk_surface_set_cursor() means that
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface will use the cursor of its parent surface. Most surfaces should
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* use this default.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_device_cursor (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GdkCursor *cursor)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2010-05-26 11:22:25 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_DEVICE (device));
|
2010-12-20 22:04:44 +00:00
|
|
|
|
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
|
|
|
|
|
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
if (!cursor)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_hash_table_remove (surface->device_cursor, device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_hash_table_replace (surface->device_cursor, device, g_object_ref (cursor));
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_cursor_internal (surface, device, cursor);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_geometry:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @x: (out) (allow-none): return location for X coordinate of surface (relative to its parent)
|
|
|
|
|
* @y: (out) (allow-none): return location for Y coordinate of surface (relative to its parent)
|
|
|
|
|
* @width: (out) (allow-none): return location for width of surface
|
|
|
|
|
* @height: (out) (allow-none): return location for height of surface
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Any of the return location arguments to this function may be %NULL,
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* if you aren’t interested in getting the value of that field.
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* The X and Y coordinates returned are relative to the parent surface
|
|
|
|
|
* of @surface, which for toplevels usually means relative to the
|
|
|
|
|
* surface decorations (titlebar, etc.) rather than relative to the
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* root window (screen-size background window).
|
|
|
|
|
*
|
|
|
|
|
* On the X11 platform, the geometry is obtained from the X server,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* so reflects the latest position of @surface; this may be out-of-sync
|
|
|
|
|
* with the position of @surface delivered in the most-recently-processed
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* #GdkEventConfigure. gdk_surface_get_position() in contrast gets the
|
2008-06-27 14:27:44 +00:00
|
|
|
|
* position from the most recent configure event.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Note: If @surface is not a toplevel, it is much better
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* to call gdk_surface_get_position(), gdk_surface_get_width() and
|
|
|
|
|
* gdk_surface_get_height() instead, because it avoids the roundtrip to
|
2010-09-20 10:53:46 +00:00
|
|
|
|
* the X server and because these functions support the full 32-bit
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* coordinate space, whereas gdk_surface_get_geometry() is restricted to
|
2010-09-20 10:53:46 +00:00
|
|
|
|
* the 16-bit coordinates of X11.
|
2014-02-02 06:22:14 +00:00
|
|
|
|
*/
|
2008-06-27 14:27:44 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_geometry (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint *x,
|
|
|
|
|
gint *y,
|
|
|
|
|
gint *width,
|
|
|
|
|
gint *height)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
return;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->get_geometry (surface, x, y, width, height);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-20 09:10:37 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_width:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2010-09-20 09:10:37 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns the width of the given @surface.
|
2010-09-20 09:10:37 +00:00
|
|
|
|
*
|
|
|
|
|
* On the X11 platform the returned size is the size reported in the
|
|
|
|
|
* most-recently-processed configure event, rather than the current
|
|
|
|
|
* size on the X server.
|
2010-09-28 00:59:08 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: The width of @surface
|
2010-09-20 09:10:37 +00:00
|
|
|
|
*/
|
|
|
|
|
int
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_width (GdkSurface *surface)
|
2010-09-20 09:10:37 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
|
2010-09-20 09:10:37 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->width;
|
2010-09-20 09:10:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_height:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2010-09-20 09:10:37 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns the height of the given @surface.
|
2010-09-20 09:10:37 +00:00
|
|
|
|
*
|
|
|
|
|
* On the X11 platform the returned size is the size reported in the
|
|
|
|
|
* most-recently-processed configure event, rather than the current
|
|
|
|
|
* size on the X server.
|
2010-09-28 00:59:08 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: The height of @surface
|
2010-09-20 09:10:37 +00:00
|
|
|
|
*/
|
|
|
|
|
int
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_height (GdkSurface *surface)
|
2010-09-20 09:10:37 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
|
2010-09-20 09:10:37 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->height;
|
2010-09-20 09:10:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-29 06:05:40 +00:00
|
|
|
|
/*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_origin:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2019-05-29 06:05:40 +00:00
|
|
|
|
* @x: (out): return location for X coordinate
|
|
|
|
|
* @y: (out): return location for Y coordinate
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Obtains the position of a surface in root window coordinates.
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* (Compare with gdk_surface_get_position() and
|
2019-05-29 06:05:40 +00:00
|
|
|
|
* gdk_surface_get_geometry() which return the position
|
|
|
|
|
* of a surface relative to its parent surface.)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
*/
|
2019-05-29 06:05:40 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_origin (GdkSurface *surface,
|
2019-05-29 06:05:40 +00:00
|
|
|
|
gint *x,
|
|
|
|
|
gint *y)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
2019-05-29 06:05:40 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
2019-05-29 06:05:40 +00:00
|
|
|
|
gdk_surface_get_root_coords (surface, 0, 0, x, y);
|
2009-06-08 15:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-29 06:05:40 +00:00
|
|
|
|
/*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_root_coords:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @x: X coordinate in surface
|
|
|
|
|
* @y: Y coordinate in surface
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @root_x: (out): return location for X coordinate
|
|
|
|
|
* @root_y: (out): return location for Y coordinate
|
2009-06-08 15:03:47 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Obtains the position of a surface position in root
|
2009-06-08 15:03:47 +00:00
|
|
|
|
* window coordinates. This is similar to
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_origin() but allows you to pass
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* in any position in the surface, not just the origin.
|
2009-06-08 15:03:47 +00:00
|
|
|
|
*/
|
2009-06-30 07:30:53 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_root_coords (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gint *root_x,
|
|
|
|
|
gint *root_y)
|
2009-06-08 15:03:47 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2009-06-08 15:03:47 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2009-06-30 07:30:53 +00:00
|
|
|
|
{
|
2011-09-28 22:16:30 +00:00
|
|
|
|
*root_x = 0;
|
|
|
|
|
*root_y = 0;
|
2009-06-30 07:30:53 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->get_root_coords (surface, x, y, root_x, root_y);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-17 10:24:46 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_input_shape_combine_region:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @shape_region: region of surface to be non-transparent
|
|
|
|
|
* @offset_x: X position of @shape_region in @surface coordinates
|
|
|
|
|
* @offset_y: Y position of @shape_region in @surface coordinates
|
2009-06-01 10:04:36 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Like gdk_surface_shape_combine_region(), but the shape applies
|
2008-12-17 10:24:46 +00:00
|
|
|
|
* only to event handling. Mouse events which happen while
|
2009-06-01 10:04:36 +00:00
|
|
|
|
* the pointer position corresponds to an unset bit in the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* mask will be passed on the surface below @surface.
|
2008-12-17 10:24:46 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* An input shape is typically used with RGBA surfaces.
|
|
|
|
|
* The alpha channel of the surface defines which pixels are
|
2008-12-17 10:24:46 +00:00
|
|
|
|
* invisible and allows for nicely antialiased borders,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* and the input shape controls where the surface is
|
2014-02-05 19:50:22 +00:00
|
|
|
|
* “clickable”.
|
2008-12-17 10:24:46 +00:00
|
|
|
|
*
|
|
|
|
|
* On the X11 platform, this requires version 1.1 of the
|
|
|
|
|
* shape extension.
|
|
|
|
|
*
|
|
|
|
|
* On the Win32 platform, this functionality is not present and the
|
|
|
|
|
* function does nothing.
|
|
|
|
|
*/
|
2009-06-01 10:04:36 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_input_shape_combine_region (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
const cairo_region_t *shape_region,
|
|
|
|
|
gint offset_x,
|
|
|
|
|
gint offset_y)
|
2008-12-17 10:24:46 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-12-17 10:24:46 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2008-12-17 10:24:46 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->input_shape)
|
|
|
|
|
cairo_region_destroy (surface->input_shape);
|
2008-12-17 10:24:46 +00:00
|
|
|
|
|
|
|
|
|
if (shape_region)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->input_shape = cairo_region_copy (shape_region);
|
|
|
|
|
cairo_region_translate (surface->input_shape, offset_x, offset_y);
|
2008-12-17 10:24:46 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->input_shape = NULL;
|
2008-12-17 10:24:46 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->input_shape_combine_region (surface, surface->input_shape, 0, 0);
|
2008-12-17 10:24:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 15:54:16 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_modal_hint:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: A toplevel #GdkSurface.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*
|
2018-07-15 19:36:19 +00:00
|
|
|
|
* Determines whether or not the window manager is hinted that @surface
|
2010-05-25 15:54:16 +00:00
|
|
|
|
* has modal behaviour.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: whether or not the surface has the modal hint set.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_modal_hint (GdkSurface *surface)
|
2010-05-25 15:54:16 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2010-05-25 15:54:16 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->modal_hint;
|
2010-05-25 15:54:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_accept_focus:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Determines whether or not the desktop environment shuld be hinted that
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* the surface does not want to receive input focus.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: whether or not the surface should receive input focus.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_accept_focus (GdkSurface *surface)
|
2010-05-25 15:54:16 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2010-05-25 15:54:16 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->accept_focus;
|
2010-05-25 15:54:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_focus_on_map:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Determines whether or not the desktop environment should be hinted that the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* surface does not want to receive input focus when it is mapped.
|
2010-05-25 15:54:16 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: whether or not the surface wants to receive input focus when
|
2010-05-25 15:54:16 +00:00
|
|
|
|
* it is mapped.
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_focus_on_map (GdkSurface *surface)
|
2010-05-25 15:54:16 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2010-05-25 15:54:16 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->focus_on_map;
|
2010-05-25 15:54:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-08 13:57:59 +00:00
|
|
|
|
static void
|
2010-05-25 22:38:44 +00:00
|
|
|
|
update_cursor (GdkDisplay *display,
|
|
|
|
|
GdkDevice *device)
|
2009-06-08 13:57:59 +00:00
|
|
|
|
{
|
2019-03-23 13:13:37 +00:00
|
|
|
|
GdkSurface *cursor_surface;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *pointer_surface;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkPointerSurfaceInfo *pointer_info;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkDeviceGrabInfo *grab;
|
2010-08-17 13:39:03 +00:00
|
|
|
|
GdkCursor *cursor;
|
2009-06-08 13:57:59 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
pointer_info = _gdk_display_get_pointer_info (display, device);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
pointer_surface = pointer_info->surface_under_pointer;
|
2009-06-08 13:57:59 +00:00
|
|
|
|
|
|
|
|
|
/* We ignore the serials here and just pick the last grab
|
|
|
|
|
we've sent, as that would shortly be used anyway. */
|
2010-05-25 22:38:44 +00:00
|
|
|
|
grab = _gdk_display_get_last_device_grab (display, device);
|
2019-03-23 13:13:37 +00:00
|
|
|
|
if (grab != NULL)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* use the cursor from the grab surface */
|
|
|
|
|
cursor_surface = grab->surface;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
2009-09-08 09:48:20 +00:00
|
|
|
|
else
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* otherwise use the cursor from the pointer surface */
|
|
|
|
|
cursor_surface = pointer_surface;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
2009-09-08 09:48:20 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cursor = g_hash_table_lookup (cursor_surface->device_cursor, device);
|
2010-08-17 13:39:03 +00:00
|
|
|
|
|
|
|
|
|
if (!cursor)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cursor = cursor_surface->cursor;
|
2010-08-17 13:39:03 +00:00
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, pointer_surface, cursor);
|
2009-06-08 13:57:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-11 20:11:48 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_beep:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2009-06-11 20:11:48 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Emits a short beep associated to @surface in the appropriate
|
2009-06-11 20:11:48 +00:00
|
|
|
|
* display, if supported. Otherwise, emits a short beep on
|
|
|
|
|
* the display just as gdk_display_beep().
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_beep (GdkSurface *surface)
|
2009-06-11 20:11:48 +00:00
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2009-06-11 20:11:48 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2009-06-11 20:11:48 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (GDK_SURFACE_GET_CLASS (surface)->beep (surface))
|
2019-03-23 13:13:37 +00:00
|
|
|
|
return;
|
2018-03-21 08:06:31 +00:00
|
|
|
|
|
2019-03-23 13:13:37 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2010-11-25 11:28:08 +00:00
|
|
|
|
gdk_display_beep (display);
|
2009-06-11 20:11:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_support_multidevice:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface.
|
|
|
|
|
* @support_multidevice: %TRUE to enable multidevice support in @surface.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function will enable multidevice features in @surface.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Multidevice aware surfaces will need to handle properly multiple,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* per device enter/leave events, device grabs and grab ownerships.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_support_multidevice (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean support_multidevice)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2010-05-25 22:38:44 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->support_multidevice == support_multidevice)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->support_multidevice = support_multidevice;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* FIXME: What to do if called when some pointers are inside the surface ? */
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_support_multidevice:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns %TRUE if the surface is aware of the existence of multiple
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* devices.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: %TRUE if the surface handles multidevice features.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_support_multidevice (GdkSurface *surface)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2010-05-25 22:38:44 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->support_multidevice;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-15 13:02:52 +00:00
|
|
|
|
void
|
2018-03-20 11:05:26 +00:00
|
|
|
|
_gdk_display_set_surface_under_pointer (GdkDisplay *display,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GdkSurface *surface)
|
2008-12-15 09:24:54 +00:00
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkPointerSurfaceInfo *device_info;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
device_info = _gdk_display_get_pointer_info (display, device);
|
|
|
|
|
|
2018-03-20 11:05:26 +00:00
|
|
|
|
if (device_info->surface_under_pointer)
|
|
|
|
|
g_object_unref (device_info->surface_under_pointer);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
device_info->surface_under_pointer = surface;
|
2008-12-15 13:02:52 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_object_ref (surface);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
update_cursor (display, device);
|
|
|
|
|
}
|
2008-12-15 09:24:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-02-02 13:57:08 +00:00
|
|
|
|
#define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GDK_BUTTON2_MASK | \
|
|
|
|
|
GDK_BUTTON3_MASK | \
|
|
|
|
|
GDK_BUTTON4_MASK | \
|
|
|
|
|
GDK_BUTTON5_MASK)
|
2009-02-02 13:57:08 +00:00
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_windowing_got_event (GdkDisplay *display,
|
2012-02-24 03:20:07 +00:00
|
|
|
|
GList *event_link,
|
|
|
|
|
GdkEvent *event,
|
|
|
|
|
gulong serial)
|
2008-07-18 13:03:42 +00:00
|
|
|
|
{
|
2018-03-20 11:05:26 +00:00
|
|
|
|
GdkSurface *event_surface;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
gboolean unlink_event = FALSE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkDeviceGrabInfo *button_release_grab;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkPointerSurfaceInfo *pointer_info = NULL;
|
2010-12-13 01:12:43 +00:00
|
|
|
|
GdkDevice *device, *source_device;
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2016-02-28 15:22:31 +00:00
|
|
|
|
_gdk_display_update_last_event (display, event);
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
device = gdk_event_get_device (event);
|
2010-12-13 01:12:43 +00:00
|
|
|
|
source_device = gdk_event_get_source_device (event);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
if (device)
|
|
|
|
|
{
|
2016-08-04 17:10:21 +00:00
|
|
|
|
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD &&
|
|
|
|
|
gdk_device_get_source (device) != GDK_SOURCE_TABLET_PAD)
|
2011-12-03 14:04:19 +00:00
|
|
|
|
{
|
2011-12-06 19:29:22 +00:00
|
|
|
|
pointer_info = _gdk_display_get_pointer_info (display, device);
|
|
|
|
|
|
2011-12-03 14:04:19 +00:00
|
|
|
|
if (source_device != pointer_info->last_slave &&
|
|
|
|
|
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
|
|
|
|
|
pointer_info->last_slave = source_device;
|
2013-01-23 16:55:59 +00:00
|
|
|
|
else if (pointer_info->last_slave)
|
2011-12-03 14:04:19 +00:00
|
|
|
|
source_device = pointer_info->last_slave;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 01:12:43 +00:00
|
|
|
|
_gdk_display_device_grab_update (display, device, source_device, serial);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2016-05-01 00:59:16 +00:00
|
|
|
|
if (gdk_device_get_input_mode (device) == GDK_MODE_DISABLED ||
|
2010-05-25 22:38:44 +00:00
|
|
|
|
!_gdk_display_check_grab_ownership (display, device, serial))
|
|
|
|
|
{
|
|
|
|
|
/* Device events are blocked by another
|
|
|
|
|
* device grab, or the device is disabled
|
|
|
|
|
*/
|
|
|
|
|
unlink_event = TRUE;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
event_surface = event->any.surface;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
if (!event_surface)
|
2012-09-26 14:28:06 +00:00
|
|
|
|
goto out;
|
2009-06-01 10:04:36 +00:00
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_ENTER_NOTIFY)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
_gdk_display_set_surface_under_pointer (display, device, event_surface);
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_LEAVE_NOTIFY)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
_gdk_display_set_surface_under_pointer (display, device, NULL);
|
2009-01-31 18:42:44 +00:00
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if ((event->any.type == GDK_BUTTON_RELEASE ||
|
|
|
|
|
event->any.type == GDK_TOUCH_CANCEL ||
|
|
|
|
|
event->any.type == GDK_TOUCH_END) &&
|
2011-12-28 23:06:45 +00:00
|
|
|
|
!event->any.send_event)
|
2009-01-31 18:42:44 +00:00
|
|
|
|
{
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_BUTTON_RELEASE ||
|
2016-05-10 19:16:45 +00:00
|
|
|
|
gdk_event_get_pointer_emulated (event))
|
2012-02-24 03:20:07 +00:00
|
|
|
|
{
|
2011-12-28 23:06:45 +00:00
|
|
|
|
button_release_grab =
|
|
|
|
|
_gdk_display_has_device_grab (display, device, serial);
|
|
|
|
|
|
|
|
|
|
if (button_release_grab &&
|
|
|
|
|
button_release_grab->implicit &&
|
|
|
|
|
(event->button.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (event->button.button - 1))) == 0)
|
|
|
|
|
{
|
|
|
|
|
button_release_grab->serial_end = serial;
|
|
|
|
|
button_release_grab->implicit_ungrab = FALSE;
|
|
|
|
|
_gdk_display_device_grab_update (display, device, source_device, serial);
|
|
|
|
|
}
|
2012-02-24 03:20:07 +00:00
|
|
|
|
}
|
2009-01-31 18:42:44 +00:00
|
|
|
|
}
|
2008-12-09 12:35:46 +00:00
|
|
|
|
|
2009-02-03 19:15:19 +00:00
|
|
|
|
out:
|
2008-12-09 12:35:46 +00:00
|
|
|
|
if (unlink_event)
|
|
|
|
|
{
|
|
|
|
|
_gdk_event_queue_remove_link (display, event_link);
|
|
|
|
|
g_list_free_1 (event_link);
|
2018-05-29 19:53:44 +00:00
|
|
|
|
g_object_unref (event);
|
2008-12-09 12:35:46 +00:00
|
|
|
|
}
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
|
|
|
|
/* This does two things - first it sees if there are motions at the
|
|
|
|
|
* end of the queue that can be compressed. Second, if there is just
|
|
|
|
|
* a single motion that won't be dispatched because it is a compression
|
|
|
|
|
* candidate it queues up flushing the event queue.
|
|
|
|
|
*/
|
|
|
|
|
_gdk_event_queue_handle_motion_compression (display);
|
Bug 318807 – Offscreen windows and window redirection.
2008-03-18 10:49:20 Tim Janik <timj@imendio.com>
* Applied pixmap redirection patch by Alexander Larsson with
various updates from:
Bug 318807 – Offscreen windows and window redirection.
Updates:
* updated docs to mention "Since 2.16".
* tests/testgtk.c: fixed snapshooting pixmap leak.
convert pixmap to pixbuf after snapshooting, to compensate for different
bit depths (occurs when snapshooting ARGB visuals and displaying the
pixmap in an RGB visual).
* gdk/gdkwindow.[hc]: made GdkWindowRedirect private.
* gdk/gdkwindow.c: removed damage idle handler, there's no aparent
need for it. enqueue damage notification as GDK_DAMAGE events
for each painting redirection at the start of the event queue.
consider windows with a redirection fully visible when invalidating,
and when updating from backing store. cleaned up stale variables.
* gdk/gdkevents.c: added _gdk_event_queue_prepend().
* gtk/gtkwidget.c: fixed coordinates for !NO_WINDOW widgets in
gtk_widget_get_snapshot; this fixes garbage snap offsets for gammacurve,
tree, drawingarea, text, handlebox, etc.
clip the redirected window hierarchy to window sizes, the visible
rectangles don't need to be taken into account here.
extended snapshooting docs to recommend gdk_pixbuf_get_from_drawable()
in case pixmap visuals could mismatch.
* gdk/x11/gdkwindow-x11.c: removed _gdk_windowing_window_get_visible_rect().
Base patch:
* tests/testgtk.c: add a "Snapshot" test to demonstrate snapshooting
of possibly obscured widgets into an offscreen pixmap.
* gtk/gtkwidget.[hc]: add GtkWidget::damage-event signal, add
gtk_widget_get_snapshot() to render a widget's contents to a GdkPixmap.
* gtk/gtkmain.c: dispatch GDK_DAMAGE events.
* gdk/gdkwindow.c: moved outer gdk_window_new() and gdk_window_reparent()
implementations here, adapted them to propagate redirects to child windows.
gdk_window_end_paint(): copy repainted window contents to redirection pixmap,
clipped to visible region. queue GDK_DAMAGE event delivery.
gdk_window_redirect_to_drawable(): install window painting redirection.
gdk_window_remove_redirection(): remove previously installed redirection.
* gdk/x11/gdkwindow-x11.c: added _gdk_windowing_window_get_visible_rect(),
renamed _gdk_window_new() and _gdk_window_reparent().
* gdk/gdkwindow.h: added GdkWindowRedirect* to GdkWindowObject, export
gdk_window_redirect_to_drawable() and gdk_window_remove_redirection().
* gdk/gdkevents.h: added GDK_DAMAGE event type.
* gdk/gdkevents.c: extract time and state from GDK_DAMAGE events.
* gdk/gdkinternals.h: added internal prototypes.
svn path=/trunk/; revision=20122
2008-05-21 19:04:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 21:43:11 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_create_similar_surface:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: surface to make new surface similar to
|
2010-08-12 21:43:11 +00:00
|
|
|
|
* @content: the content for the new surface
|
|
|
|
|
* @width: width of the new surface
|
|
|
|
|
* @height: height of the new surface
|
|
|
|
|
*
|
|
|
|
|
* Create a new surface that is as compatible as possible with the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* given @surface. For example the new surface will have the same
|
|
|
|
|
* fallback resolution and font options as @surface. Generally, the new
|
|
|
|
|
* surface will also use the same backend as @surface, unless that is
|
2010-08-12 21:43:11 +00:00
|
|
|
|
* not possible for some reason. The type of the returned surface may
|
|
|
|
|
* be examined with cairo_surface_get_type().
|
|
|
|
|
*
|
|
|
|
|
* Initially the surface contents are all 0 (transparent if contents
|
|
|
|
|
* have transparency, black otherwise.)
|
|
|
|
|
*
|
|
|
|
|
* Returns: a pointer to the newly allocated surface. The caller
|
|
|
|
|
* owns the surface and should call cairo_surface_destroy() when done
|
|
|
|
|
* with it.
|
|
|
|
|
*
|
|
|
|
|
* This function always returns a valid pointer, but it will return a
|
2014-02-05 19:50:22 +00:00
|
|
|
|
* pointer to a “nil” surface if @other is already in an error state
|
2010-08-12 21:43:11 +00:00
|
|
|
|
* or any other error occurs.
|
|
|
|
|
**/
|
|
|
|
|
cairo_surface_t *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_create_similar_surface (GdkSurface * surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
cairo_content_t content,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2010-08-12 21:43:11 +00:00
|
|
|
|
{
|
2018-04-14 20:45:33 +00:00
|
|
|
|
cairo_surface_t *similar_surface;
|
|
|
|
|
int scale;
|
2010-08-12 21:43:11 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2013-06-04 08:41:44 +00:00
|
|
|
|
|
2018-04-14 20:45:33 +00:00
|
|
|
|
scale = gdk_surface_get_scale_factor (surface);
|
2013-06-04 08:41:44 +00:00
|
|
|
|
|
2018-04-14 20:45:33 +00:00
|
|
|
|
similar_surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
|
|
|
|
|
content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_ARGB32,
|
|
|
|
|
width * scale, height * scale);
|
|
|
|
|
cairo_surface_set_device_scale (similar_surface, scale, scale);
|
2010-08-12 21:43:11 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return similar_surface;
|
2010-08-12 21:43:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_focus:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
|
|
|
|
* @timestamp: timestamp of the event triggering the surface focus
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-07-25 15:48:52 +00:00
|
|
|
|
* Sets keyboard focus to @surface. In most cases, gtk_window_present_with_time()
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* should be used on a #GtkWindow, rather than calling this function.
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_focus (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
guint32 timestamp)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->focus (surface, timestamp);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_type_hint:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: A toplevel #GdkSurface
|
|
|
|
|
* @hint: A hint of the function this surface will have
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* The application can use this call to provide a hint to the surface
|
|
|
|
|
* manager about the functionality of a surface. The window manager
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* can use this information when determining the decoration and behaviour
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* of the surface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* The hint must be set before the surface is mapped.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_type_hint (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkSurfaceTypeHint hint)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_type_hint (surface, hint);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_type_hint:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: A toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function returns the type hint set for a surface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: The type hint set for @surface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
**/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceTypeHint
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_type_hint (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
return GDK_SURFACE_GET_CLASS (surface)->get_type_hint (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_modal_hint:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: A toplevel #GdkSurface
|
|
|
|
|
* @modal: %TRUE if the surface is modal, %FALSE otherwise.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
* The application can use this hint to tell the window manager
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* that a certain surface has modal behaviour. The window manager
|
|
|
|
|
* can use this information to handle modal surfaces in a special
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* way.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* You should only use this on surfaces for which you have
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* previously called gdk_surface_set_transient_for()
|
2010-12-05 20:58:23 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_modal_hint (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean modal)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_modal_hint (surface, modal);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_geometry_hints:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @geometry: geometry hints
|
|
|
|
|
* @geom_mask: bitmask indicating fields of @geometry to pay attention to
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Sets the geometry hints for @surface. Hints flagged in @geom_mask
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* are set, hints not flagged in @geom_mask are unset.
|
|
|
|
|
* To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function provides hints to the surfaceing system about
|
|
|
|
|
* acceptable sizes for a toplevel surface. The purpose of
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* this is to constrain user resizing, but the windowing system
|
|
|
|
|
* will typically (but is not required to) also constrain the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* current size of the surface to the provided values and
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* constrain programatic resizing via gdk_surface_resize() or
|
|
|
|
|
* gdk_surface_move_resize().
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Note that on X11, this effect has no effect on surfaces
|
|
|
|
|
* of type %GDK_SURFACE_TEMP since these surfaces are not resizable
|
2016-11-04 01:37:11 +00:00
|
|
|
|
* by the user.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* Since you can’t count on the windowing system doing the
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* constraints for programmatic resizes, you should generally
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* call gdk_surface_constrain_size() yourself to determine
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* appropriate sizes.
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_geometry_hints (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
const GdkGeometry *geometry,
|
|
|
|
|
GdkSurfaceHints geom_mask)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2015-07-17 22:37:20 +00:00
|
|
|
|
g_return_if_fail (geometry != NULL || geom_mask == 0);
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_geometry_hints (surface, geometry, geom_mask);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_title:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @title: title of @surface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Sets the title of a toplevel surface, to be displayed in the titlebar.
|
|
|
|
|
* If you haven’t explicitly set the icon name for the surface
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* (using gdk_surface_set_icon_name()), the icon name will be set to
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @title as well. @title must be in UTF-8 encoding (as with all
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* user-readable strings in GDK and GTK). @title may not be %NULL.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_title (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
const gchar *title)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_title (surface, title);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_startup_id:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @startup_id: a string with startup-notification identifier
|
|
|
|
|
*
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* When using GTK, typically you should use gtk_window_set_startup_id()
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* instead of this low-level function.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_startup_id (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
const gchar *startup_id)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_startup_id (surface, startup_id);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_transient_for:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* @parent: another toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Indicates to the window manager that @surface is a transient dialog
|
|
|
|
|
* associated with the application surface @parent. This allows the
|
|
|
|
|
* window manager to do things like center @surface on @parent and
|
|
|
|
|
* keep @surface above @parent.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2014-02-07 18:37:09 +00:00
|
|
|
|
* See gtk_window_set_transient_for() if you’re using #GtkWindow or
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* #GtkDialog.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_transient_for (GdkSurface *surface,
|
2019-04-20 01:13:41 +00:00
|
|
|
|
GdkSurface *parent)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->transient_for = parent;
|
2016-07-16 00:52:35 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_transient_for (surface, parent);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_accept_focus:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @accept_focus: %TRUE if the surface should receive input focus
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
* Setting @accept_focus to %FALSE hints the desktop environment that the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* surface doesn’t want to receive input focus.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
* On X, it is the responsibility of the window manager to interpret this
|
|
|
|
|
* hint. ICCCM-compliant window manager usually respect it.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_accept_focus (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean accept_focus)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_accept_focus (surface, accept_focus);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_focus_on_map:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @focus_on_map: %TRUE if the surface should receive input focus when mapped
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
* Setting @focus_on_map to %FALSE hints the desktop environment that the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* surface doesn’t want to receive input focus when it is mapped.
|
|
|
|
|
* focus_on_map should be turned off for surfaces that aren’t triggered
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* interactively (such as popups from network activity).
|
|
|
|
|
*
|
|
|
|
|
* On X, it is the responsibility of the window manager to interpret
|
|
|
|
|
* this hint. Window managers following the freedesktop.org window
|
|
|
|
|
* manager extension specification should respect it.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_focus_on_map (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean focus_on_map)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_focus_on_map (surface, focus_on_map);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_icon_list:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: The #GdkSurface toplevel surface to set the icon of.
|
2017-11-04 19:23:33 +00:00
|
|
|
|
* @surfaces: (transfer none) (element-type GdkTexture):
|
2017-10-23 11:43:50 +00:00
|
|
|
|
* A list of image surfaces, of different sizes.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Sets a list of icons for the surface. One of these will be used
|
|
|
|
|
* to represent the surface when it has been iconified. The icon is
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* usually shown in an icon box or some sort of task bar. Which icon
|
|
|
|
|
* size is shown depends on the window manager. The window manager
|
|
|
|
|
* can scale the icon but setting several size icons can give better
|
|
|
|
|
* image quality since the window manager may only need to scale the
|
|
|
|
|
* icon by a small amount or not at all.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Note that some platforms don't support surface icons.
|
2016-08-24 18:43:58 +00:00
|
|
|
|
*/
|
2010-12-05 20:58:23 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_icon_list (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GList *textures)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_icon_list (surface, textures);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_icon_name:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @name: (allow-none): name of surface while iconified (minimized)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Surfaces may have a name used while minimized, distinct from the
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* name they display in their titlebar. Most of the time this is a bad
|
|
|
|
|
* idea from a user interface standpoint. But you can set such a name
|
|
|
|
|
* with this function, if you like.
|
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* After calling this with a non-%NULL @name, calls to gdk_surface_set_title()
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* will not update the icon title.
|
|
|
|
|
*
|
|
|
|
|
* Using %NULL for @name unsets the icon title; further calls to
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_title() will again update the icon title as well.
|
2016-08-24 18:43:58 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Note that some platforms don't support surface icons.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_icon_name (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
const gchar *name)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_icon_name (surface, name);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_iconify:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Asks to iconify (minimize) @surface. The window manager may choose
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* to ignore the request, but normally will honor it. Using
|
|
|
|
|
* gtk_window_iconify() is preferred, if you have a #GtkWindow widget.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function only makes sense when @surface is a toplevel surface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_iconify (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->iconify (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_deiconify:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Attempt to deiconify (unminimize) @surface. On X11 the window manager may
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* choose to ignore the request to deiconify. When using GTK,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* use gtk_window_deiconify() instead of the #GdkSurface variant. Or better yet,
|
2018-07-25 15:48:52 +00:00
|
|
|
|
* you probably want to use gtk_window_present_with_time(), which raises the surface, focuses it,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* unminimizes it, and puts it on the current desktop.
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_deiconify (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->deiconify (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_stick:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* “Pins” a surface such that it’s on all workspaces and does not scroll
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* with viewports, for window managers that have scrollable viewports.
|
|
|
|
|
* (When using #GtkWindow, gtk_window_stick() may be more useful.)
|
|
|
|
|
*
|
|
|
|
|
* On the X11 platform, this function depends on window manager
|
|
|
|
|
* support, so may have no effect with many window managers. However,
|
|
|
|
|
* GDK will do the best it can to convince the window manager to stick
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* the surface. For window managers that don’t support this operation,
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* there’s nothing you can do to force it to happen.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_stick (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->stick (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_unstick:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Reverse operation for gdk_surface_stick(); see gdk_surface_stick(),
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* and gtk_window_unstick().
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_unstick (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->unstick (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_maximize:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Maximizes the surface. If the surface was already maximized, then
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* this function does nothing.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On X11, asks the window manager to maximize @surface, if the window
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* manager supports this operation. Not all window managers support
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* this, and some deliberately ignore it or don’t have a concept of
|
|
|
|
|
* “maximized”; so you can’t rely on the maximization actually
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* happening. But it will happen with most standard window managers,
|
|
|
|
|
* and GDK makes a best effort to get it to happen.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On Windows, reliably maximizes the surface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_maximize (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->maximize (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_unmaximize:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Unmaximizes the surface. If the surface wasn’t maximized, then this
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* function does nothing.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On X11, asks the window manager to unmaximize @surface, if the
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* window manager supports this operation. Not all window managers
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* support this, and some deliberately ignore it or don’t have a
|
|
|
|
|
* concept of “maximized”; so you can’t rely on the unmaximization
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* actually happening. But it will happen with most standard window
|
|
|
|
|
* managers, and GDK makes a best effort to get it to happen.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On Windows, reliably unmaximizes the surface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_unmaximize (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->unmaximize (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_fullscreen:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Moves the surface into fullscreen mode. This means the
|
|
|
|
|
* surface covers the entire screen and is above any panels
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* or task bars.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If the surface was already fullscreen, then this function does nothing.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On X11, asks the window manager to put @surface in a fullscreen
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* state, if the window manager supports this operation. Not all
|
|
|
|
|
* window managers support this, and some deliberately ignore it or
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* don’t have a concept of “fullscreen”; so you can’t rely on the
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* fullscreenification actually happening. But it will happen with
|
|
|
|
|
* most standard window managers, and GDK makes a best effort to get
|
|
|
|
|
* it to happen.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_fullscreen (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->fullscreen (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-13 16:30:42 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_fullscreen_on_monitor:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2015-07-13 16:30:42 +00:00
|
|
|
|
* @monitor: Which monitor to display fullscreen on.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Moves the surface into fullscreen mode on the given monitor. This means
|
|
|
|
|
* the surface covers the entire screen and is above any panels or task bars.
|
2015-07-13 16:30:42 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If the surface was already fullscreen, then this function does nothing.
|
2015-07-13 16:30:42 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_fullscreen_on_monitor (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkMonitor *monitor)
|
2015-07-13 16:30:42 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2017-11-01 15:52:56 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_MONITOR (monitor));
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (gdk_monitor_get_display (monitor) == gdk_surface_get_display (surface));
|
2017-11-01 15:52:56 +00:00
|
|
|
|
g_return_if_fail (gdk_monitor_is_valid (monitor));
|
2015-07-13 16:30:42 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (GDK_SURFACE_GET_CLASS (surface)->fullscreen_on_monitor != NULL)
|
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->fullscreen_on_monitor (surface, monitor);
|
2015-07-13 16:30:42 +00:00
|
|
|
|
else
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->fullscreen (surface);
|
2015-07-13 16:30:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-21 10:49:45 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_fullscreen_mode:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2013-01-21 10:49:45 +00:00
|
|
|
|
* @mode: fullscreen mode
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Specifies whether the @surface should span over all monitors (in a multi-head
|
2013-01-21 10:49:45 +00:00
|
|
|
|
* setup) or only the current monitor when in fullscreen mode.
|
|
|
|
|
*
|
|
|
|
|
* The @mode argument is from the #GdkFullscreenMode enumeration.
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* If #GDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen @surface will
|
2017-11-01 21:08:04 +00:00
|
|
|
|
* span over all monitors of the display.
|
2013-01-21 10:49:45 +00:00
|
|
|
|
*
|
2017-11-01 21:08:04 +00:00
|
|
|
|
* On X11, searches through the list of monitors display the ones
|
|
|
|
|
* which delimit the 4 edges of the entire display and will ask the window
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* manager to span the @surface over these monitors.
|
2013-01-21 10:49:45 +00:00
|
|
|
|
*
|
|
|
|
|
* If the XINERAMA extension is not available or not usable, this function
|
|
|
|
|
* has no effect.
|
|
|
|
|
*
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* Not all window managers support this, so you can’t rely on the fullscreen
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* surface to span over the multiple monitors when #GDK_FULLSCREEN_ON_ALL_MONITORS
|
2013-01-21 10:49:45 +00:00
|
|
|
|
* is specified.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_fullscreen_mode (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkFullscreenMode mode)
|
2013-01-21 10:49:45 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2013-01-21 10:49:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->fullscreen_mode != mode)
|
2013-01-21 10:49:45 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->fullscreen_mode = mode;
|
2013-01-21 10:49:45 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (GDK_SURFACE_GET_CLASS (surface)->apply_fullscreen_mode != NULL)
|
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->apply_fullscreen_mode (surface);
|
2013-01-21 10:49:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_fullscreen_mode:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2013-01-21 10:49:45 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Obtains the #GdkFullscreenMode of the @surface.
|
2013-01-21 10:49:45 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: The #GdkFullscreenMode applied to the surface when fullscreen.
|
2013-01-21 10:49:45 +00:00
|
|
|
|
**/
|
|
|
|
|
GdkFullscreenMode
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_fullscreen_mode (GdkSurface *surface)
|
2013-01-21 10:49:45 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_FULLSCREEN_ON_CURRENT_MONITOR);
|
2013-01-21 10:49:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return surface->fullscreen_mode;
|
2013-01-21 10:49:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_unfullscreen:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Moves the surface out of fullscreen mode. If the surface was not
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* fullscreen, does nothing.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On X11, asks the window manager to move @surface out of the fullscreen
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* state, if the window manager supports this operation. Not all
|
|
|
|
|
* window managers support this, and some deliberately ignore it or
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* don’t have a concept of “fullscreen”; so you can’t rely on the
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* unfullscreenification actually happening. But it will happen with
|
|
|
|
|
* most standard window managers, and GDK makes a best effort to get
|
|
|
|
|
* it to happen.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_unfullscreen (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->unfullscreen (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_keep_above:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @setting: whether to keep @surface above other surfaces
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Set if @surface must be kept above other surfaces. If the
|
|
|
|
|
* surface was already above, then this function does nothing.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On X11, asks the window manager to keep @surface above, if the window
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* manager supports this operation. Not all window managers support
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* this, and some deliberately ignore it or don’t have a concept of
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* “keep above”; so you can’t rely on the surface being kept above.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* But it will happen with most standard window managers,
|
|
|
|
|
* and GDK makes a best effort to get it to happen.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_keep_above (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gboolean setting)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_keep_above (surface, setting);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_keep_below:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @setting: whether to keep @surface below other surfaces
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Set if @surface must be kept below other surfaces. If the
|
|
|
|
|
* surface was already below, then this function does nothing.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* On X11, asks the window manager to keep @surface below, if the window
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* manager supports this operation. Not all window managers support
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* this, and some deliberately ignore it or don’t have a concept of
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* “keep below”; so you can’t rely on the surface being kept below.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* But it will happen with most standard window managers,
|
|
|
|
|
* and GDK makes a best effort to get it to happen.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gdk_surface_set_keep_below (GdkSurface *surface,
|
|
|
|
|
gboolean setting)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_keep_below (surface, setting);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_decorations:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @decorations: decoration hint mask
|
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* “Decorations” are the features the window manager adds to a toplevel #GdkSurface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* This function sets the traditional Motif window manager hints that tell the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* window manager which decorations you would like your surface to have.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* Usually you should use gtk_window_set_decorated() on a #GtkWindow instead of
|
|
|
|
|
* using the GDK function directly.
|
|
|
|
|
*
|
|
|
|
|
* The @decorations argument is the logical OR of the fields in
|
|
|
|
|
* the #GdkWMDecoration enumeration. If #GDK_DECOR_ALL is included in the
|
|
|
|
|
* mask, the other bits indicate which decorations should be turned off.
|
|
|
|
|
* If #GDK_DECOR_ALL is not included, then the other bits indicate
|
|
|
|
|
* which decorations should be turned on.
|
|
|
|
|
*
|
|
|
|
|
* Most window managers honor a decorations hint of 0 to disable all decorations,
|
|
|
|
|
* but very few honor all possible combinations of bits.
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_decorations (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkWMDecoration decorations)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_decorations (surface, decorations);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_decorations:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: The toplevel #GdkSurface to get the decorations from
|
|
|
|
|
* @decorations: (out): The surface decorations will be written here
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Returns the decorations set on the GdkSurface with
|
|
|
|
|
* gdk_surface_set_decorations().
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: %TRUE if the surface has decorations set, %FALSE otherwise.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gdk_surface_get_decorations (GdkSurface *surface,
|
|
|
|
|
GdkWMDecoration *decorations)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
return GDK_SURFACE_GET_CLASS (surface)->get_decorations (surface, decorations);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_functions:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
|
|
|
|
* @functions: bitmask of operations to allow on @surface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets hints about the window management functions to make available
|
|
|
|
|
* via buttons on the window frame.
|
|
|
|
|
*
|
|
|
|
|
* On the X backend, this function sets the traditional Motif window
|
|
|
|
|
* manager hint for this purpose. However, few window managers do
|
|
|
|
|
* anything reliable or interesting with this hint. Many ignore it
|
|
|
|
|
* entirely.
|
|
|
|
|
*
|
|
|
|
|
* The @functions argument is the logical OR of values from the
|
|
|
|
|
* #GdkWMFunction enumeration. If the bitmask includes #GDK_FUNC_ALL,
|
|
|
|
|
* then the other bits indicate which functions to disable; if
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* it doesn’t include #GDK_FUNC_ALL, it indicates which functions to
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* enable.
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_functions (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkWMFunction functions)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_functions (surface, functions);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_begin_resize_drag_for_device:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @edge: the edge or corner from which the drag is started
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* @device: the device used for the operation
|
2014-01-13 03:06:59 +00:00
|
|
|
|
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
2019-03-23 18:56:21 +00:00
|
|
|
|
* @x: surface X coordinate of mouse click that began the drag
|
|
|
|
|
* @y: surface Y coordinate of mouse click that began the drag
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Begins a surface resize operation (for a toplevel surface).
|
2019-03-23 18:56:21 +00:00
|
|
|
|
* You might use this function to implement a “window resize grip,”
|
2011-11-05 05:10:16 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_begin_resize_drag_for_device (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkSurfaceEdge edge,
|
2019-03-23 18:56:21 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
gint button,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint32 timestamp)
|
2011-11-05 05:10:16 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->begin_resize_drag (surface, edge, device, button, x, y, timestamp);
|
2011-11-05 05:10:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_begin_resize_drag:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* @edge: the edge or corner from which the drag is started
|
2014-01-13 03:06:59 +00:00
|
|
|
|
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
2019-03-23 18:56:21 +00:00
|
|
|
|
* @x: surface X coordinate of mouse click that began the drag
|
|
|
|
|
* @y: surface Y coordinate of mouse click that began the drag
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Begins a surface resize operation (for a toplevel surface).
|
2011-11-05 05:10:16 +00:00
|
|
|
|
*
|
|
|
|
|
* This function assumes that the drag is controlled by the
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* client pointer device, use gdk_surface_begin_resize_drag_for_device()
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* to begin a drag with a different device.
|
|
|
|
|
*/
|
2010-12-05 20:58:23 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_begin_resize_drag (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkSurfaceEdge edge,
|
2019-03-23 18:56:21 +00:00
|
|
|
|
gint button,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint32 timestamp)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2015-12-15 22:19:49 +00:00
|
|
|
|
GdkDisplay *display;
|
2011-11-05 05:10:16 +00:00
|
|
|
|
GdkDevice *device;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2015-12-15 22:19:49 +00:00
|
|
|
|
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_begin_resize_drag_for_device (surface, edge,
|
2019-03-23 18:56:21 +00:00
|
|
|
|
device, button, x, y, timestamp);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_begin_move_drag_for_device:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* @device: the device used for the operation
|
2014-01-13 03:06:59 +00:00
|
|
|
|
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
2019-03-23 18:56:21 +00:00
|
|
|
|
* @x: surface X coordinate of mouse click that began the drag
|
|
|
|
|
* @y: surface Y coordinate of mouse click that began the drag
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @timestamp: timestamp of mouse click that began the drag
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Begins a surface move operation (for a toplevel surface).
|
2011-11-05 05:10:16 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_begin_move_drag_for_device (GdkSurface *surface,
|
2019-03-23 18:56:21 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
gint button,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint32 timestamp)
|
2011-11-05 05:10:16 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->begin_move_drag (surface,
|
|
|
|
|
device, button, x, y, timestamp);
|
2011-11-05 05:10:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_begin_move_drag:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a toplevel #GdkSurface
|
2014-01-13 03:06:59 +00:00
|
|
|
|
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
2019-03-23 18:56:21 +00:00
|
|
|
|
* @x: surface X coordinate of mouse click that began the drag
|
|
|
|
|
* @y: surface Y coordinate of mouse click that began the drag
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* @timestamp: timestamp of mouse click that began the drag
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Begins a surface move operation (for a toplevel surface).
|
2011-11-05 05:10:16 +00:00
|
|
|
|
*
|
|
|
|
|
* This function assumes that the drag is controlled by the
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* client pointer device, use gdk_surface_begin_move_drag_for_device()
|
2011-11-05 05:10:16 +00:00
|
|
|
|
* to begin a drag with a different device.
|
|
|
|
|
*/
|
2010-12-05 20:58:23 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_begin_move_drag (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint button,
|
2019-03-23 18:56:21 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
guint32 timestamp)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2015-12-15 22:19:49 +00:00
|
|
|
|
GdkDisplay *display;
|
2011-11-05 05:10:16 +00:00
|
|
|
|
GdkDevice *device;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2015-12-15 22:19:49 +00:00
|
|
|
|
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
2019-03-23 18:56:21 +00:00
|
|
|
|
gdk_surface_begin_move_drag_for_device (surface, device, button, x, y, timestamp);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_opacity:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a top-level or non-native #GdkSurface
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* @opacity: opacity
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Set @surface to render as partially transparent,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
* with opacity 0 being fully transparent and 1 fully opaque. (Values
|
|
|
|
|
* of the opacity parameter are clamped to the [0,1] range.)
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* For toplevel surfaces this depends on support from the windowing system
|
2012-11-07 12:03:32 +00:00
|
|
|
|
* that may not always be there. For instance, On X11, this works only on
|
2014-10-28 14:48:49 +00:00
|
|
|
|
* X screens with a compositing manager running. On Wayland, there is no
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* per-surface opacity value that the compositor would apply. Instead, use
|
|
|
|
|
* `gdk_surface_set_opaque_region (surface, NULL)` to tell the compositor
|
|
|
|
|
* that the entire surface is (potentially) non-opaque, and draw your content
|
2014-10-28 14:48:49 +00:00
|
|
|
|
* with alpha, or use gtk_widget_set_opacity() to set an overall opacity
|
|
|
|
|
* for your widgets.
|
2012-11-07 12:03:32 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Support for non-toplevel surfaces was added in 3.8.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_opacity (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gdouble opacity)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2012-11-07 12:03:32 +00:00
|
|
|
|
if (opacity < 0)
|
|
|
|
|
opacity = 0;
|
|
|
|
|
else if (opacity > 1)
|
|
|
|
|
opacity = 1;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->alpha = round (opacity * 255);
|
2012-11-07 12:03:32 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->destroyed)
|
2012-11-07 12:03:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->set_opacity (surface, opacity);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function is called when the XWindow is really gone.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_destroy_notify (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->destroy_notify (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_register_dnd:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Registers a surface as a potential drop destination.
|
2010-12-05 20:58:23 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_register_dnd (GdkSurface *surface)
|
2010-12-05 20:58:23 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_SURFACE_GET_CLASS (surface)->register_dnd (surface);
|
2010-12-05 20:58:23 +00:00
|
|
|
|
}
|
2010-12-09 05:02:35 +00:00
|
|
|
|
|
2010-12-10 06:27:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_drag_begin:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: the source surface for this drag
|
2015-12-07 18:47:45 +00:00
|
|
|
|
* @device: the device that controls this drag
|
2017-12-13 14:03:53 +00:00
|
|
|
|
* @content: (transfer none): the offered content
|
2017-12-11 00:45:31 +00:00
|
|
|
|
* @actions: the actions supported by this drag
|
2017-12-10 23:55:56 +00:00
|
|
|
|
* @dx: the x offset to @device's position where the drag nominally started
|
|
|
|
|
* @dy: the y offset to @device's position where the drag nominally started
|
2015-12-07 18:47:45 +00:00
|
|
|
|
*
|
|
|
|
|
* Starts a drag and creates a new drag context for it.
|
|
|
|
|
*
|
|
|
|
|
* This function is called by the drag source.
|
|
|
|
|
*
|
2018-06-29 17:34:14 +00:00
|
|
|
|
* Returns: (transfer full) (nullable): a newly created #GdkDrag or
|
2017-12-11 00:45:31 +00:00
|
|
|
|
* %NULL on error.
|
2015-12-07 18:47:45 +00:00
|
|
|
|
*/
|
2018-06-29 17:34:14 +00:00
|
|
|
|
GdkDrag *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_drag_begin (GdkSurface *surface,
|
2017-12-13 14:03:53 +00:00
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GdkContentProvider *content,
|
|
|
|
|
GdkDragAction actions,
|
|
|
|
|
gint dx,
|
|
|
|
|
gint dy)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2017-12-13 14:03:53 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_device_get_display (device), NULL);
|
2017-12-13 14:03:53 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_CONTENT_PROVIDER (content), NULL);
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
return GDK_SURFACE_GET_CLASS (surface)->drag_begin (surface, device, content, actions, dx, dy);
|
2010-12-10 06:27:10 +00:00
|
|
|
|
}
|
2010-12-16 06:21:49 +00:00
|
|
|
|
|
2012-09-26 14:28:06 +00:00
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_flush_events (GdkFrameClock *clock,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
void *data)
|
2012-09-26 14:28:06 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface = GDK_SURFACE (data);
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2013-11-11 23:04:34 +00:00
|
|
|
|
_gdk_event_queue_flush (display);
|
2012-10-07 18:13:56 +00:00
|
|
|
|
_gdk_display_pause_events (display);
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
|
|
|
|
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS);
|
2015-01-26 21:52:00 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->frame_clock_events_paused = TRUE;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_resume_events (GdkFrameClock *clock,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
void *data)
|
2012-09-26 14:28:06 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface = GDK_SURFACE (data);
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2012-10-07 18:13:56 +00:00
|
|
|
|
_gdk_display_unpause_events (display);
|
2015-01-26 21:52:00 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->frame_clock_events_paused = FALSE;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-30 20:09:44 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_frame_clock (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkFrameClock *clock)
|
2012-10-03 22:34:01 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2012-10-03 22:34:01 +00:00
|
|
|
|
g_return_if_fail (clock == NULL || GDK_IS_FRAME_CLOCK (clock));
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (clock == surface->frame_clock)
|
2012-10-03 22:34:01 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (clock)
|
|
|
|
|
{
|
|
|
|
|
g_object_ref (clock);
|
2019-05-22 20:58:24 +00:00
|
|
|
|
if (surface->parent == NULL)
|
|
|
|
|
{
|
|
|
|
|
g_signal_connect (G_OBJECT (clock),
|
|
|
|
|
"flush-events",
|
|
|
|
|
G_CALLBACK (gdk_surface_flush_events),
|
|
|
|
|
surface);
|
|
|
|
|
g_signal_connect (G_OBJECT (clock),
|
|
|
|
|
"resume-events",
|
|
|
|
|
G_CALLBACK (gdk_surface_resume_events),
|
|
|
|
|
surface);
|
|
|
|
|
g_signal_connect (G_OBJECT (clock),
|
|
|
|
|
"paint",
|
|
|
|
|
G_CALLBACK (gdk_surface_paint_on_clock),
|
|
|
|
|
surface);
|
|
|
|
|
}
|
2012-10-03 22:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->frame_clock)
|
2012-10-03 22:34:01 +00:00
|
|
|
|
{
|
2019-05-22 20:58:24 +00:00
|
|
|
|
if (surface->parent == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (surface->frame_clock_events_paused)
|
|
|
|
|
gdk_surface_resume_events (surface->frame_clock, G_OBJECT (surface));
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
|
|
|
|
|
G_CALLBACK (gdk_surface_flush_events),
|
|
|
|
|
surface);
|
|
|
|
|
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
|
|
|
|
|
G_CALLBACK (gdk_surface_resume_events),
|
|
|
|
|
surface);
|
|
|
|
|
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
|
|
|
|
|
G_CALLBACK (gdk_surface_paint_on_clock),
|
|
|
|
|
surface);
|
|
|
|
|
}
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_object_unref (surface->frame_clock);
|
2012-10-03 22:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->frame_clock = clock;
|
2012-10-03 22:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_frame_clock:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: surface to get frame clock for
|
2012-10-03 22:34:01 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Gets the frame clock for the surface. The frame clock for a surface
|
|
|
|
|
* never changes unless the surface is reparented to a new toplevel
|
|
|
|
|
* surface.
|
2012-10-03 22:34:01 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (transfer none): the frame clock
|
2012-10-03 22:34:01 +00:00
|
|
|
|
*/
|
|
|
|
|
GdkFrameClock*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_frame_clock (GdkSurface *surface)
|
2012-10-03 22:34:01 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2012-10-03 22:34:01 +00:00
|
|
|
|
|
2019-03-22 18:24:39 +00:00
|
|
|
|
return surface->frame_clock;
|
2012-10-03 22:34:01 +00:00
|
|
|
|
}
|
2013-01-18 14:47:29 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_get_scale_factor:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: surface to get scale factor for
|
2013-01-18 14:47:29 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns the internal scale factor that maps from surface coordiantes
|
2013-01-18 14:47:29 +00:00
|
|
|
|
* to the actual device pixels. On traditional systems this is 1, but
|
|
|
|
|
* on very high density outputs this can be a higher value (often 2).
|
|
|
|
|
*
|
|
|
|
|
* A higher value means that drawing is automatically scaled up to
|
|
|
|
|
* a higher resolution, so any code doing drawing will automatically look
|
|
|
|
|
* nicer. However, if you are supplying pixel-based data the scale
|
|
|
|
|
* value can be used to determine whether to use a pixel resource
|
|
|
|
|
* with higher resolution data.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* The scale of a surface may change during runtime, if this happens
|
|
|
|
|
* a configure event will be sent to the toplevel surface.
|
2013-01-18 14:47:29 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the scale factor
|
2013-01-18 14:47:29 +00:00
|
|
|
|
*/
|
|
|
|
|
gint
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_scale_factor (GdkSurface *surface)
|
2013-01-18 14:47:29 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class;
|
2013-01-18 14:47:29 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), 1);
|
2013-01-18 14:47:29 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2013-01-18 14:47:29 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
class = GDK_SURFACE_GET_CLASS (surface);
|
|
|
|
|
if (class->get_scale_factor)
|
|
|
|
|
return class->get_scale_factor (surface);
|
2013-01-18 14:47:29 +00:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2013-05-14 20:23:33 +00:00
|
|
|
|
|
2014-11-20 10:50:11 +00:00
|
|
|
|
/* Returns the *real* unscaled size, which may be a fractional size
|
2018-03-20 14:14:10 +00:00
|
|
|
|
in surface scale coordinates. We need this to properly handle GL
|
2014-11-20 10:50:11 +00:00
|
|
|
|
coordinates which are y-flipped in the real coordinates. */
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_unscaled_size (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
int *unscaled_width,
|
|
|
|
|
int *unscaled_height)
|
2014-11-20 10:50:11 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class;
|
2014-11-20 10:50:11 +00:00
|
|
|
|
gint scale;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2014-11-20 10:50:11 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
class = GDK_SURFACE_GET_CLASS (surface);
|
2014-11-20 10:50:11 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (class->get_unscaled_size)
|
|
|
|
|
{
|
|
|
|
|
class->get_unscaled_size (surface, unscaled_width, unscaled_height);
|
|
|
|
|
return;
|
2014-11-20 10:50:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
scale = gdk_surface_get_scale_factor (surface);
|
2014-11-20 10:50:11 +00:00
|
|
|
|
|
|
|
|
|
if (unscaled_width)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
*unscaled_width = surface->width * scale;
|
2014-11-20 10:50:11 +00:00
|
|
|
|
|
|
|
|
|
if (unscaled_height)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
*unscaled_height = surface->height * scale;
|
2014-11-20 10:50:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-05-14 20:23:33 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_opaque_region:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a top-level or non-native #GdkSurface
|
2015-04-18 16:54:45 +00:00
|
|
|
|
* @region: (allow-none): a region, or %NULL
|
2013-05-14 20:23:33 +00:00
|
|
|
|
*
|
2015-04-18 16:54:45 +00:00
|
|
|
|
* For optimisation purposes, compositing window managers may
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* like to not draw obscured regions of surfaces, or turn off blending
|
2013-05-14 20:23:33 +00:00
|
|
|
|
* during for these regions. With RGB windows with no transparency,
|
|
|
|
|
* this is just the shape of the window, but with ARGB32 windows, the
|
|
|
|
|
* compositor does not know what regions of the window are transparent
|
|
|
|
|
* or not.
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function only works for toplevel surfaces.
|
2013-05-14 20:23:33 +00:00
|
|
|
|
*
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* GTK will update this property automatically if
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* the @surface background is opaque, as we know where the opaque regions
|
|
|
|
|
* are. If your surface background is not opaque, please update this
|
2014-01-21 23:41:41 +00:00
|
|
|
|
* property in your #GtkWidget::style-updated handler.
|
2013-05-14 20:23:33 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_opaque_region (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
cairo_region_t *region)
|
2013-05-14 20:23:33 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class;
|
2013-05-14 20:23:33 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
|
|
|
|
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
|
2013-05-14 20:23:33 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (cairo_region_equal (surface->opaque_region, region))
|
2017-08-18 10:01:54 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_clear_pointer (&surface->opaque_region, cairo_region_destroy);
|
2017-08-18 10:01:54 +00:00
|
|
|
|
|
|
|
|
|
if (region != NULL)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->opaque_region = cairo_region_reference (region);
|
2017-08-18 10:01:54 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
class = GDK_SURFACE_GET_CLASS (surface);
|
|
|
|
|
if (class->set_opaque_region)
|
|
|
|
|
class->set_opaque_region (surface, region);
|
2013-05-14 20:23:33 +00:00
|
|
|
|
}
|
2013-12-13 03:38:12 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_set_shadow_width:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2013-12-13 03:38:12 +00:00
|
|
|
|
* @left: The left extent
|
|
|
|
|
* @right: The right extent
|
|
|
|
|
* @top: The top extent
|
|
|
|
|
* @bottom: The bottom extent
|
|
|
|
|
*
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* Newer GTK windows using client-side decorations use extra geometry
|
2013-12-13 03:38:12 +00:00
|
|
|
|
* around their frames for effects like shadows and invisible borders.
|
|
|
|
|
* Window managers that want to maximize windows or snap to edges need
|
|
|
|
|
* to know where the extents of the actual frame lie, so that users
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* don’t feel like windows are snapping against random invisible edges.
|
2013-12-13 03:38:12 +00:00
|
|
|
|
*
|
2019-02-24 15:51:21 +00:00
|
|
|
|
* Note that this property is automatically updated by GTK, so this
|
|
|
|
|
* function should only be used by applications which do not use GTK
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* to create toplevel surfaces.
|
2013-12-13 03:38:12 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_shadow_width (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
gint left,
|
|
|
|
|
gint right,
|
|
|
|
|
gint top,
|
|
|
|
|
gint bottom)
|
2013-12-13 03:38:12 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class;
|
2013-12-13 03:38:12 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
|
|
|
|
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
|
2013-12-13 03:38:12 +00:00
|
|
|
|
g_return_if_fail (left >= 0 && right >= 0 && top >= 0 && bottom >= 0);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->shadow_top = top;
|
|
|
|
|
surface->shadow_left = left;
|
|
|
|
|
surface->shadow_right = right;
|
|
|
|
|
surface->shadow_bottom = bottom;
|
2016-06-16 15:20:35 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
class = GDK_SURFACE_GET_CLASS (surface);
|
|
|
|
|
if (class->set_shadow_width)
|
|
|
|
|
class->set_shadow_width (surface, left, right, top, bottom);
|
2013-12-13 03:38:12 +00:00
|
|
|
|
}
|
2014-03-13 21:28:01 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_surface_show_window_menu:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: a #GdkSurface
|
2014-03-13 21:28:01 +00:00
|
|
|
|
* @event: a #GdkEvent to show the menu for
|
|
|
|
|
*
|
2014-05-21 23:01:37 +00:00
|
|
|
|
* Asks the windowing system to show the window menu. The window menu
|
|
|
|
|
* is the menu shown when right-clicking the titlebar on traditional
|
2014-03-13 21:28:01 +00:00
|
|
|
|
* windows managed by the window manager. This is useful for windows
|
|
|
|
|
* using client-side decorations, activating it with a right-click
|
|
|
|
|
* on the window decorations.
|
|
|
|
|
*
|
2014-05-21 23:01:37 +00:00
|
|
|
|
* Returns: %TRUE if the window menu was shown and %FALSE otherwise.
|
2014-03-13 21:28:01 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_show_window_menu (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkEvent *event)
|
2014-03-13 21:28:01 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class;
|
2014-03-13 21:28:01 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
|
|
|
|
g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
|
2014-03-13 21:28:01 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
class = GDK_SURFACE_GET_CLASS (surface);
|
|
|
|
|
if (class->show_window_menu)
|
|
|
|
|
return class->show_window_menu (surface, event);
|
2014-03-13 21:28:01 +00:00
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2017-09-18 02:09:10 +00:00
|
|
|
|
|
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_supports_edge_constraints (GdkSurface *surface)
|
2017-09-18 02:09:10 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *class;
|
2017-09-18 02:09:10 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
|
|
|
|
g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
|
2017-09-18 02:09:10 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
class = GDK_SURFACE_GET_CLASS (surface);
|
|
|
|
|
if (class->supports_edge_constraints)
|
|
|
|
|
return class->supports_edge_constraints (surface);
|
2017-09-18 02:09:10 +00:00
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2017-12-15 03:35:27 +00:00
|
|
|
|
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_state (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkSurfaceState new_state)
|
2017-12-15 03:35:27 +00:00
|
|
|
|
{
|
2018-07-15 18:23:54 +00:00
|
|
|
|
gboolean was_mapped, mapped;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2017-12-15 03:35:27 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (new_state == surface->state)
|
2017-12-15 03:35:27 +00:00
|
|
|
|
return; /* No actual work to do, nothing changed. */
|
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
/* Actually update the field in GdkSurface, this is sort of an odd
|
2017-12-15 03:35:27 +00:00
|
|
|
|
* place to do it, but seems like the safest since it ensures we expose no
|
|
|
|
|
* inconsistent state to the user.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-07-15 18:23:54 +00:00
|
|
|
|
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->state = new_state;
|
2017-12-15 03:35:27 +00:00
|
|
|
|
|
2018-07-15 18:23:54 +00:00
|
|
|
|
mapped = GDK_SURFACE_IS_MAPPED (surface);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_update_viewable (surface);
|
2017-12-15 03:35:27 +00:00
|
|
|
|
|
2019-03-24 20:30:32 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
2018-07-15 18:23:54 +00:00
|
|
|
|
|
|
|
|
|
if (was_mapped != mapped)
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
2017-12-15 03:35:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_synthesize_surface_state (GdkSurface *surface,
|
2018-03-21 08:06:31 +00:00
|
|
|
|
GdkSurfaceState unset_flags,
|
|
|
|
|
GdkSurfaceState set_flags)
|
2017-12-15 03:35:27 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
|
2017-12-15 03:35:27 +00:00
|
|
|
|
}
|
2018-07-16 00:11:56 +00:00
|
|
|
|
|
2019-04-22 21:31:33 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
check_autohide (GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkDevice *device;
|
|
|
|
|
GdkSurface *grab_surface;
|
|
|
|
|
|
|
|
|
|
switch ((guint) gdk_event_get_event_type (event))
|
|
|
|
|
{
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
#if 0
|
|
|
|
|
// FIXME: we need to ignore the release that is paired
|
|
|
|
|
// with the press starting the grab - due to implicit
|
|
|
|
|
// grabs, it will be delivered to the same place as the
|
|
|
|
|
// press, and will cause the auto dismissal to be triggered.
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
#endif
|
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
display = gdk_event_get_display (event);
|
|
|
|
|
device = gdk_event_get_device (event);
|
|
|
|
|
if (gdk_device_grab_info (display, device, &grab_surface, NULL))
|
|
|
|
|
{
|
|
|
|
|
if (grab_surface != gdk_event_get_surface (event) &&
|
|
|
|
|
grab_surface->autohide)
|
|
|
|
|
{
|
|
|
|
|
gdk_surface_hide (grab_surface);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-16 00:11:56 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_surface_handle_event (GdkEvent *event)
|
|
|
|
|
{
|
2019-02-23 18:45:10 +00:00
|
|
|
|
gboolean handled = FALSE;
|
2019-04-22 21:31:33 +00:00
|
|
|
|
|
|
|
|
|
if (check_autohide (event))
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
2018-07-16 00:11:56 +00:00
|
|
|
|
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
|
|
|
|
|
{
|
|
|
|
|
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
|
|
|
|
|
event->configure.width, event->configure.height);
|
2019-02-23 18:45:10 +00:00
|
|
|
|
handled = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
|
2018-07-16 00:11:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-23 18:45:10 +00:00
|
|
|
|
return handled;
|
2018-07-16 00:11:56 +00:00
|
|
|
|
}
|
2019-05-29 03:41:56 +00:00
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_surface_translate_coordinates (GdkSurface *from,
|
|
|
|
|
GdkSurface *to,
|
|
|
|
|
double *x,
|
|
|
|
|
double *y)
|
|
|
|
|
{
|
|
|
|
|
int x1, y1, x2, y2;
|
|
|
|
|
GdkSurface *f, *t;
|
|
|
|
|
|
|
|
|
|
x1 = 0;
|
|
|
|
|
y1 = 0;
|
|
|
|
|
f = from;
|
|
|
|
|
while (f->parent)
|
|
|
|
|
{
|
|
|
|
|
x1 += f->x;
|
|
|
|
|
y1 += f->y;
|
|
|
|
|
f = f->parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x2 = 0;
|
|
|
|
|
y2 = 0;
|
|
|
|
|
t = to;
|
|
|
|
|
while (t->parent)
|
|
|
|
|
{
|
|
|
|
|
x2 += t->x;
|
|
|
|
|
y2 += t->y;
|
|
|
|
|
t = t->parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (f != t)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
*x += x1 - x2;
|
|
|
|
|
*y += y1 - y2;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|