forked from AuroraMiddleware/gtk
Get rid of GdkSurfaceImpl
We don't need the complicated wrapper system anymore, since client-side windows are gone. This commit moves all the vfuncs to GtkSurfaceClass, and changes the backends to just derive their surface implementation from GdkSurface.
This commit is contained in:
parent
93b8f2563d
commit
712a5d4f25
@ -20,7 +20,7 @@
|
||||
|
||||
#include "gdkdevice-broadway.h"
|
||||
|
||||
#include "gdksurface.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
|
||||
static gboolean gdk_broadway_device_get_history (GdkDevice *device,
|
||||
@ -251,7 +251,7 @@ gdk_broadway_device_grab (GdkDevice *device,
|
||||
{
|
||||
/* Device is a pointer */
|
||||
return _gdk_broadway_server_grab_pointer (broadway_display->server,
|
||||
GDK_SURFACE_IMPL_BROADWAY (surface->impl)->id,
|
||||
GDK_BROADWAY_SURFACE (surface)->id,
|
||||
owner_events,
|
||||
event_mask,
|
||||
time_);
|
||||
|
@ -95,10 +95,10 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
|
||||
toplevels = broadway_display->toplevels;
|
||||
for (l = toplevels; l != NULL; l = l->next)
|
||||
{
|
||||
GdkSurfaceImplBroadway *toplevel_impl = l->data;
|
||||
GdkBroadwaySurface *toplevel = l->data;
|
||||
|
||||
if (toplevel_impl->maximized)
|
||||
gdk_surface_move_resize (toplevel_impl->wrapper, 0, 0, msg->width, msg->height);
|
||||
if (toplevel->maximized)
|
||||
gdk_surface_move_resize (GDK_SURFACE (toplevel), 0, 0, msg->width, msg->height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,7 +420,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
object_class->dispose = gdk_broadway_display_dispose;
|
||||
object_class->finalize = gdk_broadway_display_finalize;
|
||||
|
||||
display_class->surface_type = GDK_TYPE_BROADWAY_SURFACE;
|
||||
display_class->cairo_context_type = GDK_TYPE_BROADWAY_CAIRO_CONTEXT;
|
||||
|
||||
display_class->get_name = gdk_broadway_display_get_name;
|
||||
@ -435,7 +434,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
|
||||
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
|
||||
display_class->create_surface_impl = _gdk_broadway_display_create_surface_impl;
|
||||
display_class->create_surface = _gdk_broadway_display_create_surface;
|
||||
display_class->get_keymap = _gdk_broadway_display_get_keymap;
|
||||
display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
@ -94,7 +94,7 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDrag *new_context;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
g_return_val_if_fail (GDK_SURFACE_IS_BROADWAY (surface), NULL);
|
||||
g_return_val_if_fail (GDK_IS_BROADWAY_SURFACE (surface), NULL);
|
||||
|
||||
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG,
|
||||
"device", device,
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "gdkeventsource.h"
|
||||
#include "gdkseat.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -101,9 +101,13 @@ void _gdk_broadway_display_get_default_cursor_size (GdkDisplay *display,
|
||||
void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void _gdk_broadway_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent);
|
||||
GdkSurface * _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
gint _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
@ -125,6 +129,4 @@ void _gdk_broadway_surface_resize_surface (GdkSurface *surface);
|
||||
void _gdk_broadway_cursor_update_theme (GdkCursor *cursor);
|
||||
void _gdk_broadway_cursor_display_finalize (GdkDisplay *display);
|
||||
|
||||
#define GDK_SURFACE_IS_BROADWAY(win) (GDK_IS_SURFACE_IMPL_BROADWAY (((GdkSurface *)win)->impl))
|
||||
|
||||
#endif /* __GDK_PRIVATE_BROADWAY_H__ */
|
||||
|
@ -29,50 +29,26 @@
|
||||
|
||||
#include "gdkbroadwaydisplay.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdksurfaceimpl.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkeventsource.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include <gdk/gdkframeclockprivate.h>
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Forward declarations */
|
||||
static void gdk_surface_impl_broadway_finalize (GObject *object);
|
||||
static void gdk_broadway_surface_finalize (GObject *object);
|
||||
|
||||
#define SURFACE_IS_TOPLEVEL(surface) TRUE
|
||||
|
||||
struct _GdkBroadwaySurface {
|
||||
GdkSurface parent;
|
||||
};
|
||||
|
||||
struct _GdkBroadwaySurfaceClass {
|
||||
GdkSurfaceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwaySurface, gdk_broadway_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *broadway_surface_class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_init (GdkBroadwaySurface *broadway_surface)
|
||||
{
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GdkSurfaceImplBroadway,
|
||||
gdk_surface_impl_broadway,
|
||||
GDK_TYPE_SURFACE_IMPL)
|
||||
|
||||
|
||||
/* We need to flush in an idle rather than AFTER_PAINT, as the clock
|
||||
is frozen during e.g. surface resizes so the paint will not happen
|
||||
and the surface resize request is never flushed. */
|
||||
@ -83,26 +59,23 @@ queue_flush (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_impl_broadway_init (GdkSurfaceImplBroadway *impl)
|
||||
gdk_broadway_surface_init (GdkBroadwaySurface *impl)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_impl_broadway_finalize (GObject *object)
|
||||
gdk_broadway_surface_finalize (GObject *object)
|
||||
{
|
||||
GdkSurface *wrapper;
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE_IMPL_BROADWAY (object));
|
||||
g_return_if_fail (GDK_IS_BROADWAY_SURFACE (object));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (object);
|
||||
impl = GDK_BROADWAY_SURFACE (object);
|
||||
|
||||
wrapper = impl->wrapper;
|
||||
_gdk_broadway_surface_grab_check_destroy (GDK_SURFACE (impl));
|
||||
|
||||
_gdk_broadway_surface_grab_check_destroy (wrapper);
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (impl->wrapper));
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (GDK_SURFACE (impl)));
|
||||
|
||||
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
|
||||
|
||||
@ -111,7 +84,7 @@ gdk_surface_impl_broadway_finalize (GObject *object)
|
||||
|
||||
broadway_display->toplevels = g_list_remove (broadway_display->toplevels, impl);
|
||||
|
||||
G_OBJECT_CLASS (gdk_surface_impl_broadway_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_broadway_surface_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -124,10 +97,10 @@ thaw_clock_cb (GdkFrameClock *clock)
|
||||
|
||||
void
|
||||
_gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
guint32 tag,
|
||||
gboolean local_reply)
|
||||
guint32 tag,
|
||||
gboolean local_reply)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
@ -160,10 +133,10 @@ _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
|
||||
static void
|
||||
on_frame_clock_after_paint (GdkFrameClock *clock,
|
||||
GdkSurface *surface)
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkSurfaceImplBroadway *impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
|
||||
@ -178,7 +151,7 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
|
||||
|
||||
static void
|
||||
on_frame_clock_before_paint (GdkFrameClock *clock,
|
||||
GdkSurface *surface)
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GdkFrameTimings *timings = gdk_frame_clock_get_current_timings (clock);
|
||||
gint64 presentation_time;
|
||||
@ -203,29 +176,46 @@ on_frame_clock_before_paint (GdkFrameClock *clock,
|
||||
static void
|
||||
connect_frame_clock (GdkSurface *surface)
|
||||
{
|
||||
if (SURFACE_IS_TOPLEVEL (surface))
|
||||
{
|
||||
GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
|
||||
GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
|
||||
|
||||
g_signal_connect (frame_clock, "before-paint",
|
||||
G_CALLBACK (on_frame_clock_before_paint), surface);
|
||||
g_signal_connect (frame_clock, "after-paint",
|
||||
G_CALLBACK (on_frame_clock_after_paint), surface);
|
||||
}
|
||||
g_signal_connect (frame_clock, "before-paint",
|
||||
G_CALLBACK (on_frame_clock_before_paint), surface);
|
||||
g_signal_connect (frame_clock, "after-paint",
|
||||
G_CALLBACK (on_frame_clock_after_paint), surface);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent)
|
||||
GdkSurface *
|
||||
_gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
GdkFrameClock *frame_clock;
|
||||
GdkSurface *surface;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
|
||||
surface = g_object_new (GDK_TYPE_BROADWAY_SURFACE,
|
||||
"display", display,
|
||||
"frame-clock", frame_clock,
|
||||
NULL);
|
||||
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
surface->surface_type = surface_type;
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
|
||||
impl = g_object_new (GDK_TYPE_SURFACE_IMPL_BROADWAY, NULL);
|
||||
surface->impl = (GdkSurfaceImpl *)impl;
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
impl->id = _gdk_broadway_server_new_surface (broadway_display->server,
|
||||
surface->x,
|
||||
surface->y,
|
||||
@ -233,7 +223,6 @@ _gdk_broadway_display_create_surface_impl (GdkDisplay *display,
|
||||
surface->height,
|
||||
surface->surface_type == GDK_SURFACE_TEMP);
|
||||
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
|
||||
impl->wrapper = surface;
|
||||
|
||||
g_assert (surface->surface_type == GDK_SURFACE_TOPLEVEL ||
|
||||
surface->surface_type == GDK_SURFACE_TEMP);
|
||||
@ -241,15 +230,15 @@ _gdk_broadway_display_create_surface_impl (GdkDisplay *display,
|
||||
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
|
||||
|
||||
connect_frame_clock (surface);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_surface_broadway_ref_cairo_surface (GdkSurface *surface)
|
||||
gdk_broadway_surface_ref_cairo_surface (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
|
||||
if (GDK_IS_SURFACE_IMPL_BROADWAY (surface) &&
|
||||
GDK_SURFACE_DESTROYED (impl->wrapper))
|
||||
if (GDK_IS_BROADWAY_SURFACE (surface) &&
|
||||
GDK_SURFACE_DESTROYED (surface))
|
||||
return NULL;
|
||||
|
||||
return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
||||
@ -257,14 +246,14 @@ gdk_surface_broadway_ref_cairo_surface (GdkSurface *surface)
|
||||
|
||||
static void
|
||||
_gdk_broadway_surface_destroy (GdkSurface *surface,
|
||||
gboolean foreign_destroy)
|
||||
gboolean foreign_destroy)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (impl->node_data)
|
||||
g_array_unref (impl->node_data);
|
||||
@ -282,15 +271,15 @@ _gdk_broadway_surface_destroy (GdkSurface *surface,
|
||||
|
||||
void
|
||||
gdk_broadway_surface_set_nodes (GdkSurface *surface,
|
||||
GArray *nodes,
|
||||
GPtrArray *node_textures)
|
||||
GArray *nodes,
|
||||
GPtrArray *node_textures)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
|
||||
@ -321,13 +310,13 @@ gdk_broadway_surface_destroy_notify (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_show (GdkSurface *surface,
|
||||
gboolean already_mapped)
|
||||
gdk_broadway_surface_show (GdkSurface *surface,
|
||||
gboolean already_mapped)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
impl->visible = TRUE;
|
||||
|
||||
/* FIXME: update state ? */
|
||||
@ -339,12 +328,12 @@ gdk_surface_broadway_show (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_hide (GdkSurface *surface)
|
||||
gdk_broadway_surface_hide (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
impl->visible = FALSE;
|
||||
|
||||
/* FIXME: update state ? */
|
||||
@ -361,20 +350,20 @@ gdk_surface_broadway_hide (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_withdraw (GdkSurface *surface)
|
||||
gdk_broadway_surface_withdraw (GdkSurface *surface)
|
||||
{
|
||||
gdk_surface_broadway_hide (surface);
|
||||
gdk_broadway_surface_hide (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_move_resize (GdkSurface *surface,
|
||||
gdk_broadway_surface_move_resize (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
gboolean size_changed;
|
||||
|
||||
@ -418,19 +407,19 @@ gdk_surface_broadway_move_resize (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_raise (GdkSurface *surface)
|
||||
gdk_broadway_surface_raise (GdkSurface *surface)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_restack_toplevel (GdkSurface *surface,
|
||||
gdk_broadway_surface_restack_toplevel (GdkSurface *surface,
|
||||
GdkSurface *sibling,
|
||||
gboolean above)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_lower (GdkSurface *surface)
|
||||
gdk_broadway_surface_lower (GdkSurface *surface)
|
||||
{
|
||||
}
|
||||
|
||||
@ -439,7 +428,7 @@ static void
|
||||
gdk_broadway_surface_focus (GdkSurface *surface,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
@ -448,7 +437,7 @@ gdk_broadway_surface_focus (GdkSurface *surface,
|
||||
!surface->accept_focus)
|
||||
return;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
_gdk_broadway_server_surface_focus (broadway_display->server,
|
||||
impl->id);
|
||||
@ -473,26 +462,26 @@ gdk_broadway_surface_set_modal_hint (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_geometry_hints (GdkSurface *surface,
|
||||
gdk_broadway_surface_set_geometry_hints (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask)
|
||||
GdkSurfaceHints geom_mask)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
impl->geometry_hints = *geometry;
|
||||
impl->geometry_hints_mask = geom_mask;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_title (GdkSurface *surface,
|
||||
gdk_broadway_surface_set_title (GdkSurface *surface,
|
||||
const gchar *title)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_startup_id (GdkSurface *surface,
|
||||
gdk_broadway_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id)
|
||||
{
|
||||
}
|
||||
@ -502,66 +491,58 @@ gdk_broadway_surface_set_transient_for (GdkSurface *surface,
|
||||
GdkSurface *parent)
|
||||
{
|
||||
GdkBroadwayDisplay *display;
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
int parent_id;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
parent_id = 0;
|
||||
if (parent)
|
||||
parent_id = GDK_SURFACE_IMPL_BROADWAY (parent->impl)->id;
|
||||
parent_id = GDK_BROADWAY_SURFACE (parent)->id;
|
||||
|
||||
impl->transient_for = parent_id;
|
||||
|
||||
display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (impl->wrapper));
|
||||
display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
_gdk_broadway_server_surface_set_transient_for (display->server, impl->id, impl->transient_for);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_get_geometry (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
gdk_broadway_surface_get_geometry (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
|
||||
/* TODO: These should really roundtrip to the client to get the current data */
|
||||
|
||||
if (x)
|
||||
*x = impl->wrapper->x;
|
||||
*x = surface->x;
|
||||
if (y)
|
||||
*y = impl->wrapper->y;
|
||||
*y = surface->y;
|
||||
if (width)
|
||||
*width = impl->wrapper->width;
|
||||
*width = surface->width;
|
||||
if (height)
|
||||
*height = impl->wrapper->height;
|
||||
*height = surface->height;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_get_root_coords (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *root_x,
|
||||
gint *root_y)
|
||||
gdk_broadway_surface_get_root_coords (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *root_x,
|
||||
gint *root_y)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
|
||||
if (root_x)
|
||||
*root_x = x + impl->wrapper->x;
|
||||
*root_x = x + surface->x;
|
||||
if (root_y)
|
||||
*root_y = y + impl->wrapper->y;
|
||||
*root_y = y + surface->y;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_get_frame_extents (GdkSurface *surface,
|
||||
gdk_broadway_surface_get_frame_extents (GdkSurface *surface,
|
||||
GdkRectangle *rect)
|
||||
{
|
||||
g_return_if_fail (rect != NULL);
|
||||
@ -575,7 +556,7 @@ gdk_broadway_surface_get_frame_extents (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_surface_broadway_get_device_state (GdkSurface *surface,
|
||||
gdk_broadway_surface_get_device_state (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
@ -596,7 +577,7 @@ gdk_surface_broadway_get_device_state (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_broadway_input_shape_combine_region (GdkSurface *surface,
|
||||
gdk_broadway_surface_input_shape_combine_region (GdkSurface *surface,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
@ -683,7 +664,7 @@ gdk_broadway_surface_unstick (GdkSurface *surface)
|
||||
static void
|
||||
gdk_broadway_surface_maximize (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle geom;
|
||||
@ -692,7 +673,7 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
return;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (impl->maximized)
|
||||
return;
|
||||
@ -718,13 +699,13 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
|
||||
static void
|
||||
gdk_broadway_surface_unmaximize (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) ||
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
return;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (!impl->maximized)
|
||||
return;
|
||||
@ -1188,9 +1169,9 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MoveResizeData *mv_resize;
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) ||
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
@ -1207,8 +1188,8 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
mv_resize->is_resize = TRUE;
|
||||
mv_resize->moveresize_button = button;
|
||||
mv_resize->resize_edge = edge;
|
||||
mv_resize->moveresize_x = x + impl->wrapper->x;
|
||||
mv_resize->moveresize_y = y + impl->wrapper->y;
|
||||
mv_resize->moveresize_x = x + surface->x;
|
||||
mv_resize->moveresize_y = y + surface->y;
|
||||
mv_resize->moveresize_surface = g_object_ref (surface);
|
||||
|
||||
mv_resize->moveresize_orig_width = gdk_surface_get_width (surface);
|
||||
@ -1231,9 +1212,9 @@ gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MoveResizeData *mv_resize;
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) ||
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
@ -1249,8 +1230,8 @@ gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
|
||||
|
||||
mv_resize->is_resize = FALSE;
|
||||
mv_resize->moveresize_button = button;
|
||||
mv_resize->moveresize_x = x + impl->wrapper->x;
|
||||
mv_resize->moveresize_y = y + impl->wrapper->y;
|
||||
mv_resize->moveresize_x = x + surface->x;
|
||||
mv_resize->moveresize_y = y + surface->y;
|
||||
mv_resize->moveresize_surface = g_object_ref (surface);
|
||||
|
||||
mv_resize->moveresize_orig_width = gdk_surface_get_width (surface);
|
||||
@ -1296,25 +1277,25 @@ gdk_broadway_get_last_seen_time (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass)
|
||||
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkSurfaceImplClass *impl_class = GDK_SURFACE_IMPL_CLASS (klass);
|
||||
GdkSurfaceClass *impl_class = GDK_SURFACE_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_surface_impl_broadway_finalize;
|
||||
object_class->finalize = gdk_broadway_surface_finalize;
|
||||
|
||||
impl_class->ref_cairo_surface = gdk_surface_broadway_ref_cairo_surface;
|
||||
impl_class->show = gdk_surface_broadway_show;
|
||||
impl_class->hide = gdk_surface_broadway_hide;
|
||||
impl_class->withdraw = gdk_surface_broadway_withdraw;
|
||||
impl_class->raise = gdk_surface_broadway_raise;
|
||||
impl_class->lower = gdk_surface_broadway_lower;
|
||||
impl_class->restack_toplevel = gdk_surface_broadway_restack_toplevel;
|
||||
impl_class->move_resize = gdk_surface_broadway_move_resize;
|
||||
impl_class->get_geometry = gdk_surface_broadway_get_geometry;
|
||||
impl_class->get_root_coords = gdk_surface_broadway_get_root_coords;
|
||||
impl_class->get_device_state = gdk_surface_broadway_get_device_state;
|
||||
impl_class->input_shape_combine_region = gdk_surface_broadway_input_shape_combine_region;
|
||||
impl_class->ref_cairo_surface = gdk_broadway_surface_ref_cairo_surface;
|
||||
impl_class->show = gdk_broadway_surface_show;
|
||||
impl_class->hide = gdk_broadway_surface_hide;
|
||||
impl_class->withdraw = gdk_broadway_surface_withdraw;
|
||||
impl_class->raise = gdk_broadway_surface_raise;
|
||||
impl_class->lower = gdk_broadway_surface_lower;
|
||||
impl_class->restack_toplevel = gdk_broadway_surface_restack_toplevel;
|
||||
impl_class->move_resize = gdk_broadway_surface_move_resize;
|
||||
impl_class->get_geometry = gdk_broadway_surface_get_geometry;
|
||||
impl_class->get_root_coords = gdk_broadway_surface_get_root_coords;
|
||||
impl_class->get_device_state = gdk_broadway_surface_get_device_state;
|
||||
impl_class->input_shape_combine_region = gdk_broadway_surface_input_shape_combine_region;
|
||||
impl_class->destroy = _gdk_broadway_surface_destroy;
|
||||
impl_class->beep = gdk_broadway_surface_beep;
|
||||
|
||||
|
@ -25,28 +25,17 @@
|
||||
#ifndef __GDK_SURFACE_BROADWAY_H__
|
||||
#define __GDK_SURFACE_BROADWAY_H__
|
||||
|
||||
#include <gdk/gdksurfaceimpl.h>
|
||||
#include <gdk/gdksurfaceprivate.h>
|
||||
#include "gdkbroadwaysurface.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkSurfaceImplBroadway GdkSurfaceImplBroadway;
|
||||
typedef struct _GdkSurfaceImplBroadwayClass GdkSurfaceImplBroadwayClass;
|
||||
|
||||
/* Surface implementation for Broadway
|
||||
*/
|
||||
|
||||
#define GDK_TYPE_SURFACE_IMPL_BROADWAY (gdk_surface_impl_broadway_get_type ())
|
||||
#define GDK_SURFACE_IMPL_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SURFACE_IMPL_BROADWAY, GdkSurfaceImplBroadway))
|
||||
#define GDK_SURFACE_IMPL_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SURFACE_IMPL_BROADWAY, GdkSurfaceImplBroadwayClass))
|
||||
#define GDK_IS_SURFACE_IMPL_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SURFACE_IMPL_BROADWAY))
|
||||
#define GDK_IS_SURFACE_IMPL_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SURFACE_IMPL_BROADWAY))
|
||||
#define GDK_SURFACE_IMPL_BROADWAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE_IMPL_BROADWAY, GdkSurfaceImplBroadwayClass))
|
||||
|
||||
struct _GdkSurfaceImplBroadway
|
||||
struct _GdkBroadwaySurface
|
||||
{
|
||||
GdkSurfaceImpl parent_instance;
|
||||
|
||||
GdkSurface *wrapper;
|
||||
GdkSurface parent_instance;
|
||||
|
||||
GdkCursor *cursor;
|
||||
|
||||
@ -73,12 +62,12 @@ struct _GdkSurfaceImplBroadway
|
||||
GPtrArray *node_data_textures;
|
||||
};
|
||||
|
||||
struct _GdkSurfaceImplBroadwayClass
|
||||
struct _GdkBroadwaySurfaceClass
|
||||
{
|
||||
GdkSurfaceImplClass parent_class;
|
||||
GdkSurfaceClass parent_class;
|
||||
};
|
||||
|
||||
GType gdk_surface_impl_broadway_get_type (void);
|
||||
GType gdk_surface_broadway_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkevents.h"
|
||||
#include "gdksurfaceimpl.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <glib.h>
|
||||
@ -171,8 +171,6 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
object_class->get_property = gdk_display_get_property;
|
||||
|
||||
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
|
||||
class->surface_type = GDK_TYPE_SURFACE;
|
||||
|
||||
class->opened = gdk_display_real_opened;
|
||||
class->make_default = gdk_display_real_make_default;
|
||||
class->event_data_copy = gdk_display_real_event_data_copy;
|
||||
@ -1324,22 +1322,19 @@ _gdk_display_event_data_free (GdkDisplay *display,
|
||||
GDK_DISPLAY_GET_CLASS (display)->event_data_free (display, event);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent)
|
||||
{
|
||||
GDK_DISPLAY_GET_CLASS (display)->create_surface_impl (display,
|
||||
surface,
|
||||
real_parent);
|
||||
}
|
||||
|
||||
GdkSurface *
|
||||
_gdk_display_create_surface (GdkDisplay *display)
|
||||
gdk_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->surface_type,
|
||||
"display", display,
|
||||
NULL);
|
||||
return GDK_DISPLAY_GET_CLASS (display)->create_surface (display,
|
||||
surface_type,
|
||||
parent,
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +112,6 @@ struct _GdkDisplayClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
GType surface_type; /* type for native surfaces for this display, set in class_init */
|
||||
GType cairo_context_type; /* type for GdkCairoContext, must be set */
|
||||
GType vk_context_type; /* type for GdkVulkanContext, must be set if vk_extension_name != NULL */
|
||||
const char *vk_extension_name; /* Name of required windowing vulkan extension or %NULL (default) if Vulkan isn't supported */
|
||||
@ -141,9 +140,13 @@ struct _GdkDisplayClass
|
||||
GdkEvent *new_event);
|
||||
void (*event_data_free) (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
void (*create_surface_impl) (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent);
|
||||
GdkSurface * (*create_surface) (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
GdkKeymap * (*get_keymap) (GdkDisplay *display);
|
||||
|
||||
@ -228,10 +231,13 @@ void _gdk_display_event_data_copy (GdkDisplay *display
|
||||
GdkEvent *new_event);
|
||||
void _gdk_display_event_data_free (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
void gdk_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent);
|
||||
GdkSurface * _gdk_display_create_surface (GdkDisplay *display);
|
||||
GdkSurface * gdk_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
gboolean gdk_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
|
@ -28,9 +28,9 @@
|
||||
#define __GDK_INTERNALS_H__
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include "gdksurfaceimpl.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
@ -116,79 +116,6 @@ typedef enum
|
||||
|
||||
typedef struct _GdkSurfacePaint GdkSurfacePaint;
|
||||
|
||||
struct _GdkSurface
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkDisplay *display;
|
||||
|
||||
GdkSurfaceImpl *impl; /* window-system-specific delegate object */
|
||||
|
||||
GdkSurface *transient_for;
|
||||
|
||||
gpointer widget;
|
||||
|
||||
gint x;
|
||||
gint y;
|
||||
|
||||
guint8 surface_type;
|
||||
|
||||
guint8 resize_count;
|
||||
|
||||
GdkGLContext *gl_paint_context;
|
||||
|
||||
cairo_region_t *update_area;
|
||||
guint update_freeze_count;
|
||||
/* This is the update_area that was in effect when the current expose
|
||||
started. It may be smaller than the expose area if we'e painting
|
||||
more than we have to, but it represents the "true" damage. */
|
||||
cairo_region_t *active_update_area;
|
||||
|
||||
GdkSurfaceState old_state;
|
||||
GdkSurfaceState state;
|
||||
|
||||
guint8 alpha;
|
||||
guint8 fullscreen_mode;
|
||||
|
||||
guint modal_hint : 1;
|
||||
|
||||
guint destroyed : 2;
|
||||
|
||||
guint accept_focus : 1;
|
||||
guint focus_on_map : 1;
|
||||
guint support_multidevice : 1;
|
||||
guint viewable : 1; /* mapped and all parents mapped */
|
||||
guint in_update : 1;
|
||||
guint frame_clock_events_paused : 1;
|
||||
|
||||
/* The GdkSurface that has the impl, ref:ed if another surface.
|
||||
* This ref is required to keep the wrapper of the impl surface alive
|
||||
* for as long as any GdkSurface references the impl. */
|
||||
GdkSurface *impl_surface;
|
||||
|
||||
guint update_and_descendants_freeze_count;
|
||||
|
||||
gint width, height;
|
||||
gint shadow_top;
|
||||
gint shadow_left;
|
||||
gint shadow_right;
|
||||
gint shadow_bottom;
|
||||
|
||||
GdkCursor *cursor;
|
||||
GHashTable *device_cursor;
|
||||
|
||||
cairo_region_t *input_shape;
|
||||
|
||||
GList *devices_inside;
|
||||
|
||||
GdkFrameClock *frame_clock; /* NULL to use from parent or default */
|
||||
|
||||
GSList *draw_contexts;
|
||||
GdkDrawContext *paint_context;
|
||||
|
||||
cairo_region_t *opaque_region;
|
||||
};
|
||||
|
||||
#define GDK_SURFACE_TYPE(d) ((((GdkSurface *)(d)))->surface_type)
|
||||
#define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)
|
||||
|
||||
|
577
gdk/gdksurface.c
577
gdk/gdksurface.c
File diff suppressed because it is too large
Load Diff
@ -411,21 +411,6 @@ typedef struct _GdkSurfaceClass GdkSurfaceClass;
|
||||
#define GDK_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE, GdkSurfaceClass))
|
||||
|
||||
|
||||
struct _GdkSurfaceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gdk_reserved1) (void);
|
||||
void (*_gdk_reserved2) (void);
|
||||
void (*_gdk_reserved3) (void);
|
||||
void (*_gdk_reserved4) (void);
|
||||
void (*_gdk_reserved5) (void);
|
||||
void (*_gdk_reserved6) (void);
|
||||
void (*_gdk_reserved7) (void);
|
||||
void (*_gdk_reserved8) (void);
|
||||
};
|
||||
|
||||
/* Surfaces
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -1,312 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdksurfaceimpl.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GdkSurfaceImpl, gdk_surface_impl, G_TYPE_OBJECT);
|
||||
|
||||
static gboolean
|
||||
gdk_surface_impl_beep (GdkSurface *surface)
|
||||
{
|
||||
/* FALSE means surfaces can't beep, so the display will be
|
||||
* made to beep instead. */
|
||||
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 x;
|
||||
gint y;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best_monitor)
|
||||
return best_monitor;
|
||||
|
||||
x = rect->x + rect->width / 2;
|
||||
y = rect->y + rect->height / 2;
|
||||
|
||||
return gdk_display_get_monitor_at_point (display, x, y);
|
||||
}
|
||||
|
||||
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_impl_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)
|
||||
{
|
||||
GdkSurface *transient_for_toplevel;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle bounds;
|
||||
GdkRectangle root_rect = *rect;
|
||||
GdkRectangle flipped_rect;
|
||||
GdkRectangle final_rect;
|
||||
gboolean flipped_x;
|
||||
gboolean flipped_y;
|
||||
|
||||
/*
|
||||
* First translate the anchor rect to toplevel coordinates. This is needed
|
||||
* because not all backends will be able to get root coordinates for
|
||||
* non-toplevel surfaces.
|
||||
*/
|
||||
transient_for_toplevel = surface->transient_for;
|
||||
|
||||
gdk_surface_get_root_coords (transient_for_toplevel,
|
||||
root_rect.x,
|
||||
root_rect.y,
|
||||
&root_rect.x,
|
||||
&root_rect.y);
|
||||
|
||||
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);
|
||||
|
||||
g_signal_emit_by_name (surface,
|
||||
"moved-to-rect",
|
||||
&flipped_rect,
|
||||
&final_rect,
|
||||
flipped_x,
|
||||
flipped_y);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_impl_class_init (GdkSurfaceImplClass *impl_class)
|
||||
{
|
||||
impl_class->beep = gdk_surface_impl_beep;
|
||||
impl_class->move_to_rect = gdk_surface_impl_move_to_rect;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_impl_init (GdkSurfaceImpl *impl)
|
||||
{
|
||||
}
|
@ -1,212 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_SURFACE_IMPL_H__
|
||||
#define __GDK_SURFACE_IMPL_H__
|
||||
|
||||
#include <gdk/gdksurface.h>
|
||||
#include <gdk/gdkproperty.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_SURFACE_IMPL (gdk_surface_impl_get_type ())
|
||||
#define GDK_SURFACE_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SURFACE_IMPL, GdkSurfaceImpl))
|
||||
#define GDK_SURFACE_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SURFACE_IMPL, GdkSurfaceImplClass))
|
||||
#define GDK_IS_SURFACE_IMPL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SURFACE_IMPL))
|
||||
#define GDK_IS_SURFACE_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SURFACE_IMPL))
|
||||
#define GDK_SURFACE_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE_IMPL, GdkSurfaceImplClass))
|
||||
|
||||
typedef struct _GdkSurfaceImpl GdkSurfaceImpl;
|
||||
typedef struct _GdkSurfaceImplClass GdkSurfaceImplClass;
|
||||
|
||||
struct _GdkSurfaceImpl
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
struct _GdkSurfaceImplClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
cairo_surface_t *
|
||||
(* ref_cairo_surface) (GdkSurface *surface);
|
||||
|
||||
void (* show) (GdkSurface *surface,
|
||||
gboolean already_mapped);
|
||||
void (* hide) (GdkSurface *surface);
|
||||
void (* withdraw) (GdkSurface *surface);
|
||||
void (* raise) (GdkSurface *surface);
|
||||
void (* lower) (GdkSurface *surface);
|
||||
void (* restack_toplevel) (GdkSurface *surface,
|
||||
GdkSurface *sibling,
|
||||
gboolean above);
|
||||
|
||||
void (* move_resize) (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void (* 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);
|
||||
|
||||
void (* get_geometry) (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void (* get_root_coords) (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *root_x,
|
||||
gint *root_y);
|
||||
gboolean (* get_device_state) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
GdkModifierType *mask);
|
||||
|
||||
void (* input_shape_combine_region) (GdkSurface *surface,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
|
||||
/* Called to do the windowing system specific part of gdk_surface_destroy(),
|
||||
*
|
||||
* surface: The window being destroyed
|
||||
* 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.)
|
||||
*/
|
||||
void (* destroy) (GdkSurface *surface,
|
||||
gboolean foreign_destroy);
|
||||
|
||||
|
||||
/* optional */
|
||||
gboolean (* beep) (GdkSurface *surface);
|
||||
|
||||
void (* focus) (GdkSurface *surface,
|
||||
guint32 timestamp);
|
||||
void (* set_type_hint) (GdkSurface *surface,
|
||||
GdkSurfaceTypeHint hint);
|
||||
GdkSurfaceTypeHint (* get_type_hint) (GdkSurface *surface);
|
||||
void (* set_modal_hint) (GdkSurface *surface,
|
||||
gboolean modal);
|
||||
void (* set_geometry_hints) (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask);
|
||||
void (* set_title) (GdkSurface *surface,
|
||||
const gchar *title);
|
||||
void (* set_startup_id) (GdkSurface *surface,
|
||||
const gchar *startup_id);
|
||||
void (* set_transient_for) (GdkSurface *surface,
|
||||
GdkSurface *parent);
|
||||
void (* get_frame_extents) (GdkSurface *surface,
|
||||
GdkRectangle *rect);
|
||||
void (* set_accept_focus) (GdkSurface *surface,
|
||||
gboolean accept_focus);
|
||||
void (* set_focus_on_map) (GdkSurface *surface,
|
||||
gboolean focus_on_map);
|
||||
void (* set_icon_list) (GdkSurface *surface,
|
||||
GList *pixbufs);
|
||||
void (* set_icon_name) (GdkSurface *surface,
|
||||
const gchar *name);
|
||||
void (* iconify) (GdkSurface *surface);
|
||||
void (* deiconify) (GdkSurface *surface);
|
||||
void (* stick) (GdkSurface *surface);
|
||||
void (* unstick) (GdkSurface *surface);
|
||||
void (* maximize) (GdkSurface *surface);
|
||||
void (* unmaximize) (GdkSurface *surface);
|
||||
void (* fullscreen) (GdkSurface *surface);
|
||||
void (* fullscreen_on_monitor) (GdkSurface *surface,
|
||||
GdkMonitor *monitor);
|
||||
void (* apply_fullscreen_mode) (GdkSurface *surface);
|
||||
void (* unfullscreen) (GdkSurface *surface);
|
||||
void (* set_keep_above) (GdkSurface *surface,
|
||||
gboolean setting);
|
||||
void (* set_keep_below) (GdkSurface *surface,
|
||||
gboolean setting);
|
||||
void (* set_decorations) (GdkSurface *surface,
|
||||
GdkWMDecoration decorations);
|
||||
gboolean (* get_decorations) (GdkSurface *surface,
|
||||
GdkWMDecoration *decorations);
|
||||
void (* set_functions) (GdkSurface *surface,
|
||||
GdkWMFunction functions);
|
||||
void (* begin_resize_drag) (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move_drag) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* set_opacity) (GdkSurface *surface,
|
||||
gdouble opacity);
|
||||
void (* destroy_notify) (GdkSurface *surface);
|
||||
void (* register_dnd) (GdkSurface *surface);
|
||||
GdkDrag * (*drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider*content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
gint (* get_scale_factor) (GdkSurface *surface);
|
||||
void (* get_unscaled_size) (GdkSurface *surface,
|
||||
int *unscaled_width,
|
||||
int *unscaled_height);
|
||||
|
||||
void (* set_opaque_region) (GdkSurface *surface,
|
||||
cairo_region_t *region);
|
||||
void (* set_shadow_width) (GdkSurface *surface,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom);
|
||||
gboolean (* show_window_menu) (GdkSurface *surface,
|
||||
GdkEvent *event);
|
||||
GdkGLContext *(*create_gl_context) (GdkSurface *surface,
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
gboolean (* supports_edge_constraints)(GdkSurface *surface);
|
||||
};
|
||||
|
||||
/* Interface Functions */
|
||||
GType gdk_surface_impl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_SURFACE_IMPL_H__ */
|
@ -21,7 +21,6 @@
|
||||
#define __GDK_SURFACE_PRIVATE_H__
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include "gdksurfaceimpl.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdksurface.h"
|
||||
|
||||
@ -33,8 +32,6 @@ struct _GdkSurface
|
||||
|
||||
GdkDisplay *display;
|
||||
|
||||
GdkSurfaceImpl *impl; /* window-system-specific delegate object */
|
||||
|
||||
GdkSurface *transient_for;
|
||||
|
||||
gpointer widget;
|
||||
@ -72,11 +69,6 @@ struct _GdkSurface
|
||||
guint in_update : 1;
|
||||
guint frame_clock_events_paused : 1;
|
||||
|
||||
/* The GdkSurface that has the impl, ref:ed if another surface.
|
||||
* This ref is required to keep the wrapper of the impl surface alive
|
||||
* for as long as any GdkSurface references the impl. */
|
||||
GdkSurface *impl_surface;
|
||||
|
||||
guint update_and_descendants_freeze_count;
|
||||
|
||||
gint width, height;
|
||||
@ -102,17 +94,161 @@ struct _GdkSurface
|
||||
|
||||
struct _GdkSurfaceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gdk_reserved1) (void);
|
||||
void (*_gdk_reserved2) (void);
|
||||
void (*_gdk_reserved3) (void);
|
||||
void (*_gdk_reserved4) (void);
|
||||
void (*_gdk_reserved5) (void);
|
||||
void (*_gdk_reserved6) (void);
|
||||
void (*_gdk_reserved7) (void);
|
||||
void (*_gdk_reserved8) (void);
|
||||
cairo_surface_t *
|
||||
(* ref_cairo_surface) (GdkSurface *surface);
|
||||
|
||||
void (* show) (GdkSurface *surface,
|
||||
gboolean already_mapped);
|
||||
void (* hide) (GdkSurface *surface);
|
||||
void (* withdraw) (GdkSurface *surface);
|
||||
void (* raise) (GdkSurface *surface);
|
||||
void (* lower) (GdkSurface *surface);
|
||||
void (* restack_toplevel) (GdkSurface *surface,
|
||||
GdkSurface *sibling,
|
||||
gboolean above);
|
||||
|
||||
void (* move_resize) (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void (* 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);
|
||||
|
||||
void (* get_geometry) (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void (* get_root_coords) (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *root_x,
|
||||
gint *root_y);
|
||||
gboolean (* get_device_state) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
GdkModifierType *mask);
|
||||
|
||||
void (* input_shape_combine_region) (GdkSurface *surface,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
|
||||
/* Called to do the windowing system specific part of gdk_surface_destroy(),
|
||||
*
|
||||
* surface: The window being destroyed
|
||||
* 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.)
|
||||
*/
|
||||
void (* destroy) (GdkSurface *surface,
|
||||
gboolean foreign_destroy);
|
||||
|
||||
|
||||
/* optional */
|
||||
gboolean (* beep) (GdkSurface *surface);
|
||||
|
||||
void (* focus) (GdkSurface *surface,
|
||||
guint32 timestamp);
|
||||
void (* set_type_hint) (GdkSurface *surface,
|
||||
GdkSurfaceTypeHint hint);
|
||||
GdkSurfaceTypeHint (* get_type_hint) (GdkSurface *surface);
|
||||
void (* set_modal_hint) (GdkSurface *surface,
|
||||
gboolean modal);
|
||||
void (* set_geometry_hints) (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask);
|
||||
void (* set_title) (GdkSurface *surface,
|
||||
const gchar *title);
|
||||
void (* set_startup_id) (GdkSurface *surface,
|
||||
const gchar *startup_id);
|
||||
void (* set_transient_for) (GdkSurface *surface,
|
||||
GdkSurface *parent);
|
||||
void (* get_frame_extents) (GdkSurface *surface,
|
||||
GdkRectangle *rect);
|
||||
void (* set_accept_focus) (GdkSurface *surface,
|
||||
gboolean accept_focus);
|
||||
void (* set_focus_on_map) (GdkSurface *surface,
|
||||
gboolean focus_on_map);
|
||||
void (* set_icon_list) (GdkSurface *surface,
|
||||
GList *pixbufs);
|
||||
void (* set_icon_name) (GdkSurface *surface,
|
||||
const gchar *name);
|
||||
void (* iconify) (GdkSurface *surface);
|
||||
void (* deiconify) (GdkSurface *surface);
|
||||
void (* stick) (GdkSurface *surface);
|
||||
void (* unstick) (GdkSurface *surface);
|
||||
void (* maximize) (GdkSurface *surface);
|
||||
void (* unmaximize) (GdkSurface *surface);
|
||||
void (* fullscreen) (GdkSurface *surface);
|
||||
void (* fullscreen_on_monitor) (GdkSurface *surface,
|
||||
GdkMonitor *monitor);
|
||||
void (* apply_fullscreen_mode) (GdkSurface *surface);
|
||||
void (* unfullscreen) (GdkSurface *surface);
|
||||
void (* set_keep_above) (GdkSurface *surface,
|
||||
gboolean setting);
|
||||
void (* set_keep_below) (GdkSurface *surface,
|
||||
gboolean setting);
|
||||
void (* set_decorations) (GdkSurface *surface,
|
||||
GdkWMDecoration decorations);
|
||||
gboolean (* get_decorations) (GdkSurface *surface,
|
||||
GdkWMDecoration *decorations);
|
||||
void (* set_functions) (GdkSurface *surface,
|
||||
GdkWMFunction functions);
|
||||
void (* begin_resize_drag) (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move_drag) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* set_opacity) (GdkSurface *surface,
|
||||
gdouble opacity);
|
||||
void (* destroy_notify) (GdkSurface *surface);
|
||||
void (* register_dnd) (GdkSurface *surface);
|
||||
GdkDrag * (*drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider*content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
gint (* get_scale_factor) (GdkSurface *surface);
|
||||
void (* get_unscaled_size) (GdkSurface *surface,
|
||||
int *unscaled_width,
|
||||
int *unscaled_height);
|
||||
|
||||
void (* set_opaque_region) (GdkSurface *surface,
|
||||
cairo_region_t *region);
|
||||
void (* set_shadow_width) (GdkSurface *surface,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom);
|
||||
gboolean (* show_window_menu) (GdkSurface *surface,
|
||||
GdkEvent *event);
|
||||
GdkGLContext *(*create_gl_context) (GdkSurface *surface,
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
gboolean (* supports_edge_constraints)(GdkSurface *surface);
|
||||
};
|
||||
|
||||
void gdk_surface_set_state (GdkSurface *surface,
|
||||
|
@ -44,7 +44,6 @@ gdk_public_sources = files([
|
||||
'gdktexture.c',
|
||||
'gdkvulkancontext.c',
|
||||
'gdksurface.c',
|
||||
'gdksurfaceimpl.c',
|
||||
'gdkprofiler.c'
|
||||
])
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <gdk/gdksurface.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdktypes.h"
|
||||
#include "gdkclipboard-wayland.h"
|
||||
#include "gdkclipboardprivate.h"
|
||||
#include "gdkprivate-wayland.h"
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkmonitor-wayland.h"
|
||||
#include "gdkseat-wayland.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkprivate-wayland.h"
|
||||
@ -1004,7 +1004,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
object_class->dispose = gdk_wayland_display_dispose;
|
||||
object_class->finalize = gdk_wayland_display_finalize;
|
||||
|
||||
display_class->surface_type = gdk_wayland_surface_get_type ();
|
||||
display_class->cairo_context_type = GDK_TYPE_WAYLAND_CAIRO_CONTEXT;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
@ -1026,7 +1025,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
|
||||
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
|
||||
display_class->notify_startup_complete = gdk_wayland_display_notify_startup_complete;
|
||||
display_class->create_surface_impl = _gdk_wayland_display_create_surface_impl;
|
||||
display_class->create_surface = _gdk_wayland_display_create_surface;
|
||||
display_class->get_keymap = _gdk_wayland_display_get_keymap;
|
||||
display_class->text_property_to_utf8_list = _gdk_wayland_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_wayland_display_utf8_to_string_target;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "gdkprivate-wayland.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
#include "gdkintl.h"
|
||||
|
||||
@ -176,7 +177,7 @@ gdk_wayland_gl_context_get_damage (GdkGLContext *context)
|
||||
shared = context;
|
||||
shared_wayland = GDK_WAYLAND_GL_CONTEXT (shared);
|
||||
|
||||
egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface,
|
||||
egl_surface = gdk_wayland_surface_get_egl_surface (surface,
|
||||
shared_wayland->egl_config);
|
||||
gdk_gl_context_make_current (shared);
|
||||
eglQuerySurface (display_wayland->egl_display, egl_surface,
|
||||
@ -228,7 +229,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface,
|
||||
egl_surface = gdk_wayland_surface_get_egl_surface (surface,
|
||||
context_wayland->egl_config);
|
||||
|
||||
gdk_wayland_surface_sync (surface);
|
||||
@ -513,13 +514,13 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
|
||||
surface = gdk_gl_context_get_surface (context);
|
||||
|
||||
if (context_wayland->is_attached || gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)))
|
||||
egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface, context_wayland->egl_config);
|
||||
egl_surface = gdk_wayland_surface_get_egl_surface (surface, context_wayland->egl_config);
|
||||
else
|
||||
{
|
||||
if (display_wayland->have_egl_surfaceless_context)
|
||||
egl_surface = EGL_NO_SURFACE;
|
||||
else
|
||||
egl_surface = gdk_wayland_surface_get_dummy_egl_surface (surface->impl_surface,
|
||||
egl_surface = gdk_wayland_surface_get_dummy_egl_surface (surface,
|
||||
context_wayland->egl_config);
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,6 @@
|
||||
#define WL_SURFACE_HAS_BUFFER_SCALE 3
|
||||
#define WL_POINTER_HAS_FRAME 5
|
||||
|
||||
#define GDK_SURFACE_IS_WAYLAND(win) (GDK_IS_SURFACE_IMPL_WAYLAND (((GdkSurface *)win)->impl))
|
||||
|
||||
GdkKeymap *_gdk_wayland_keymap_new (GdkDisplay *display);
|
||||
void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
|
||||
uint32_t format,
|
||||
@ -116,9 +114,13 @@ void gdk_wayland_drop_set_source_actions (GdkDrop
|
||||
void gdk_wayland_drop_set_action (GdkDrop *drop,
|
||||
uint32_t action);
|
||||
|
||||
void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent);
|
||||
GdkSurface * _gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@
|
||||
#include "gdkprivate-x11.h"
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -318,7 +318,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
||||
else
|
||||
{
|
||||
xwindow = GDK_SURFACE_XID (surface);
|
||||
scale = GDK_SURFACE_IMPL_X11 (surface->impl)->surface_scale;
|
||||
scale = GDK_X11_SURFACE (surface)->surface_scale;
|
||||
}
|
||||
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE)
|
||||
@ -467,7 +467,7 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
GdkDisplay *display;
|
||||
GdkX11Screen *screen;
|
||||
@ -616,7 +616,7 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
|
||||
surface = gdk_x11_surface_lookup_for_display (display, last);
|
||||
impl = NULL;
|
||||
if (surface)
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (mask)
|
||||
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
|
||||
|
@ -1480,7 +1480,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GdkDevice *device, *source_device;
|
||||
gboolean return_val = TRUE;
|
||||
GdkSurface *surface;
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
int scale;
|
||||
XIEvent *ev;
|
||||
|
||||
@ -1505,7 +1505,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
scale = 1;
|
||||
if (surface)
|
||||
{
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
scale = impl->surface_scale;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkmarshalers.h"
|
||||
#include "xsettings-client.h"
|
||||
@ -638,7 +639,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
Window xwindow;
|
||||
GdkSurface *surface;
|
||||
gboolean is_substructure;
|
||||
GdkSurfaceImplX11 *surface_impl = NULL;
|
||||
GdkX11Surface *surface_impl = NULL;
|
||||
GdkX11Screen *x11_screen = NULL;
|
||||
GdkToplevelX11 *toplevel = NULL;
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
@ -668,7 +669,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
x11_screen = GDK_SURFACE_SCREEN (surface);
|
||||
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
||||
surface_impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
surface_impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
g_object_ref (surface);
|
||||
}
|
||||
@ -1209,8 +1210,8 @@ _gdk_wm_protocols_filter (const XEvent *xevent,
|
||||
* in the message for everything that gets stuffed in */
|
||||
if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_FRAME_DRAWN"))
|
||||
{
|
||||
GdkSurfaceImplX11 *surface_impl;
|
||||
surface_impl = GDK_SURFACE_IMPL_X11 (win->impl);
|
||||
GdkX11Surface *surface_impl;
|
||||
surface_impl = GDK_X11_SURFACE (win);
|
||||
if (surface_impl->toplevel)
|
||||
{
|
||||
guint32 d0 = xevent->xclient.data.l[0];
|
||||
@ -1247,8 +1248,8 @@ _gdk_wm_protocols_filter (const XEvent *xevent,
|
||||
|
||||
if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_FRAME_TIMINGS"))
|
||||
{
|
||||
GdkSurfaceImplX11 *surface_impl;
|
||||
surface_impl = GDK_SURFACE_IMPL_X11 (win->impl);
|
||||
GdkX11Surface *surface_impl;
|
||||
surface_impl = GDK_X11_SURFACE (win);
|
||||
if (surface_impl->toplevel)
|
||||
{
|
||||
guint32 d0 = xevent->xclient.data.l[0];
|
||||
@ -3023,7 +3024,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
object_class->dispose = gdk_x11_display_dispose;
|
||||
object_class->finalize = gdk_x11_display_finalize;
|
||||
|
||||
display_class->surface_type = GDK_TYPE_X11_SURFACE;
|
||||
display_class->cairo_context_type = GDK_TYPE_X11_CAIRO_CONTEXT;
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
display_class->vk_context_type = GDK_TYPE_X11_VULKAN_CONTEXT;
|
||||
@ -3045,7 +3045,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
display_class->get_next_serial = gdk_x11_display_get_next_serial;
|
||||
display_class->get_startup_notification_id = gdk_x11_display_get_startup_notification_id;
|
||||
display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete;
|
||||
display_class->create_surface_impl = _gdk_x11_display_create_surface_impl;
|
||||
display_class->create_surface = _gdk_x11_display_create_surface;
|
||||
display_class->get_keymap = gdk_x11_display_get_keymap;
|
||||
display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkproperty.h"
|
||||
@ -532,14 +533,14 @@ gdk_surface_cache_new (GdkDisplay *display)
|
||||
{
|
||||
GList *toplevel_windows, *list;
|
||||
GdkSurface *surface;
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
gint x, y, width, height;
|
||||
|
||||
toplevel_windows = gdk_x11_display_get_toplevel_windows (display);
|
||||
for (list = toplevel_windows; list; list = list->next)
|
||||
{
|
||||
surface = GDK_SURFACE (list->data);
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
gdk_surface_get_geometry (surface, &x, &y, &width, &height);
|
||||
gdk_surface_cache_add (result, GDK_SURFACE_XID (surface),
|
||||
x * impl->surface_scale, y * impl->surface_scale,
|
||||
@ -1401,11 +1402,11 @@ drag_find_window_cache (GdkX11Drag *drag_x11,
|
||||
}
|
||||
|
||||
static Window
|
||||
gdk_x11_drag_find_surface (GdkDrag *drag,
|
||||
GdkSurface *drag_surface,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
gdk_x11_drag_find_surface (GdkDrag *drag,
|
||||
GdkSurface *drag_surface,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
{
|
||||
GdkX11Screen *screen_x11;
|
||||
GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
|
||||
@ -1420,7 +1421,7 @@ gdk_x11_drag_find_surface (GdkDrag *drag,
|
||||
window_cache = drag_find_window_cache (drag_x11, display);
|
||||
|
||||
dest = get_client_window_at_coords (window_cache,
|
||||
drag_surface && GDK_SURFACE_IS_X11 (drag_surface) ?
|
||||
drag_surface && GDK_IS_X11_SURFACE (drag_surface) ?
|
||||
GDK_SURFACE_XID (drag_surface) : None,
|
||||
x_root * screen_x11->surface_scale,
|
||||
y_root * screen_x11->surface_scale);
|
||||
|
@ -621,7 +621,7 @@ static gboolean
|
||||
xdnd_position_filter (GdkSurface *surface,
|
||||
const XEvent *xevent)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
Window source_window = xevent->xclient.data.l[0];
|
||||
gint16 x_root = xevent->xclient.data.l[2] >> 16;
|
||||
gint16 y_root = xevent->xclient.data.l[2] & 0xffff;
|
||||
@ -647,7 +647,7 @@ xdnd_position_filter (GdkSurface *surface,
|
||||
if ((drop != NULL) &&
|
||||
(drop_x11->source_window == source_window))
|
||||
{
|
||||
impl = GDK_SURFACE_IMPL_X11 (gdk_drop_get_surface (drop)->impl);
|
||||
impl = GDK_X11_SURFACE (gdk_drop_get_surface (drop));
|
||||
|
||||
drop_x11->suggested_action = xdnd_action_from_atom (display, action);
|
||||
gdk_x11_drop_update_actions (drop_x11);
|
||||
|
@ -410,7 +410,7 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_DISPLAY (display_x11), OPENGL, g_message ("Using GLX_EXT_texture_from_pixmap to draw surface"));
|
||||
|
||||
surface = gdk_gl_context_get_surface (paint_context)->impl_surface;
|
||||
surface = gdk_gl_context_get_surface (paint_context);
|
||||
surface_scale = gdk_surface_get_scale_factor (surface);
|
||||
gdk_surface_get_unscaled_size (surface, NULL, &unscaled_surface_height);
|
||||
|
||||
@ -679,7 +679,7 @@ gdk_x11_gl_context_realize (GdkGLContext *context,
|
||||
|
||||
xvisinfo = find_xvisinfo_for_fbconfig (display, context_x11->glx_config);
|
||||
|
||||
info = get_glx_drawable_info (surface->impl_surface);
|
||||
info = get_glx_drawable_info (surface);
|
||||
if (info == NULL)
|
||||
{
|
||||
XSetWindowAttributes attrs;
|
||||
@ -708,7 +708,7 @@ gdk_x11_gl_context_realize (GdkGLContext *context,
|
||||
if (GDK_X11_DISPLAY (display)->glx_version >= 13)
|
||||
{
|
||||
info->glx_drawable = glXCreateWindow (dpy, context_x11->glx_config,
|
||||
gdk_x11_surface_get_xid (surface->impl_surface),
|
||||
gdk_x11_surface_get_xid (surface),
|
||||
NULL);
|
||||
info->dummy_glx = glXCreateWindow (dpy, context_x11->glx_config, info->dummy_xwin, NULL);
|
||||
}
|
||||
@ -727,12 +727,12 @@ gdk_x11_gl_context_realize (GdkGLContext *context,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
set_glx_drawable_info (surface->impl_surface, info);
|
||||
set_glx_drawable_info (surface, info);
|
||||
}
|
||||
|
||||
XFree (xvisinfo);
|
||||
|
||||
context_x11->attached_drawable = info->glx_drawable ? info->glx_drawable : gdk_x11_surface_get_xid (surface->impl_surface);
|
||||
context_x11->attached_drawable = info->glx_drawable ? info->glx_drawable : gdk_x11_surface_get_xid (surface);
|
||||
context_x11->unattached_drawable = info->dummy_glx ? info->dummy_glx : info->dummy_xwin;
|
||||
|
||||
context_x11->is_direct = glXIsDirect (dpy, context_x11->glx_context);
|
||||
|
@ -176,9 +176,14 @@ void _gdk_x11_display_get_default_cursor_size (GdkDisplay *display,
|
||||
void _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void _gdk_x11_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *window,
|
||||
GdkSurface *real_parent);
|
||||
|
||||
GdkSurface * _gdk_x11_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display);
|
||||
|
||||
void _gdk_x11_precache_atoms (GdkDisplay *display,
|
||||
@ -240,7 +245,6 @@ extern const gint _gdk_x11_event_mask_table_size;
|
||||
#define GDK_SURFACE_SCREEN(win) (GDK_X11_DISPLAY (gdk_surface_get_display (win))->screen)
|
||||
#define GDK_SURFACE_DISPLAY(win) (gdk_surface_get_display (win))
|
||||
#define GDK_SURFACE_XROOTWIN(win) (GDK_X11_SCREEN (GDK_SURFACE_SCREEN (win))->xroot_window)
|
||||
#define GDK_SURFACE_IS_X11(win) (GDK_IS_SURFACE_IMPL_X11 ((win)->impl))
|
||||
|
||||
/* override some macros from gdkx.h with direct-access variants */
|
||||
#undef GDK_DISPLAY_XDISPLAY
|
||||
@ -250,7 +254,7 @@ extern const gint _gdk_x11_event_mask_table_size;
|
||||
|
||||
#define GDK_DISPLAY_XDISPLAY(display) (GDK_X11_DISPLAY(display)->xdisplay)
|
||||
#define GDK_SURFACE_XDISPLAY(win) (GDK_X11_SCREEN (GDK_SURFACE_SCREEN (win))->xdisplay)
|
||||
#define GDK_SURFACE_XID(win) (GDK_SURFACE_IMPL_X11(GDK_SURFACE (win)->impl)->xid)
|
||||
#define GDK_SURFACE_XID(win) (GDK_X11_SURFACE (win)->xid)
|
||||
#define GDK_SCREEN_XDISPLAY(screen) (GDK_X11_SCREEN (screen)->xdisplay)
|
||||
|
||||
#endif /* __GDK_PRIVATE_X11_H__ */
|
||||
|
@ -27,12 +27,11 @@
|
||||
|
||||
#include "gdksurface-x11.h"
|
||||
|
||||
#include "gdksurface.h"
|
||||
#include "gdksurfaceimpl.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkvisual-x11.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
#include "gdkasync.h"
|
||||
#include "gdkeventsource.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
@ -108,8 +107,6 @@ static void set_wm_name (GdkDisplay *display,
|
||||
const gchar *name);
|
||||
static void move_to_current_desktop (GdkSurface *surface);
|
||||
|
||||
static void gdk_surface_impl_x11_finalize (GObject *object);
|
||||
|
||||
#define SURFACE_IS_TOPLEVEL(surface) \
|
||||
(GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL || \
|
||||
GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP)
|
||||
@ -122,31 +119,10 @@ static void gdk_surface_impl_x11_finalize (GObject *object);
|
||||
(( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 )) \
|
||||
)
|
||||
|
||||
struct _GdkX11Surface {
|
||||
GdkSurface parent;
|
||||
};
|
||||
|
||||
struct _GdkX11SurfaceClass {
|
||||
GdkSurfaceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkX11Surface, gdk_x11_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
static void
|
||||
gdk_x11_surface_class_init (GdkX11SurfaceClass *x11_surface_class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_init (GdkX11Surface *x11_surface)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GdkSurfaceImplX11, gdk_surface_impl_x11, GDK_TYPE_SURFACE_IMPL)
|
||||
|
||||
static void
|
||||
gdk_surface_impl_x11_init (GdkSurfaceImplX11 *impl)
|
||||
gdk_x11_surface_init (GdkX11Surface *impl)
|
||||
{
|
||||
impl->surface_scale = 1;
|
||||
impl->frame_sync_enabled = TRUE;
|
||||
@ -155,14 +131,14 @@ gdk_surface_impl_x11_init (GdkSurfaceImplX11 *impl)
|
||||
GdkToplevelX11 *
|
||||
_gdk_x11_surface_get_toplevel (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
||||
|
||||
if (!SURFACE_IS_TOPLEVEL (surface))
|
||||
return NULL;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (!impl->toplevel)
|
||||
{
|
||||
@ -175,13 +151,13 @@ _gdk_x11_surface_get_toplevel (GdkSurface *surface)
|
||||
|
||||
/**
|
||||
* _gdk_x11_surface_update_size:
|
||||
* @impl: a #GdkSurfaceImplX11.
|
||||
* @impl: a #GdkX11Surface.
|
||||
*
|
||||
* Updates the state of the surface (in particular the drawable's
|
||||
* cairo surface) when its size has changed.
|
||||
**/
|
||||
void
|
||||
_gdk_x11_surface_update_size (GdkSurfaceImplX11 *impl)
|
||||
_gdk_x11_surface_update_size (GdkX11Surface *impl)
|
||||
{
|
||||
if (impl->cairo_surface)
|
||||
{
|
||||
@ -195,7 +171,7 @@ gdk_x11_surface_get_unscaled_size (GdkSurface *surface,
|
||||
int *unscaled_width,
|
||||
int *unscaled_height)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (unscaled_width)
|
||||
*unscaled_width = impl->unscaled_width;
|
||||
@ -228,18 +204,18 @@ void
|
||||
gdk_x11_surface_pre_damage (GdkSurface *surface)
|
||||
{
|
||||
GdkSurface *toplevel_surface = surface;
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
if (!toplevel_surface || !SURFACE_IS_TOPLEVEL (toplevel_surface))
|
||||
return;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (toplevel_surface->impl);
|
||||
impl = GDK_X11_SURFACE (toplevel_surface);
|
||||
|
||||
if (impl->toplevel->in_frame &&
|
||||
impl->toplevel->current_counter_value % 2 == 0)
|
||||
{
|
||||
impl->toplevel->current_counter_value += 1;
|
||||
set_sync_counter (GDK_SURFACE_XDISPLAY (impl->wrapper),
|
||||
set_sync_counter (GDK_SURFACE_XDISPLAY (surface),
|
||||
impl->toplevel->extended_update_counter,
|
||||
impl->toplevel->current_counter_value);
|
||||
}
|
||||
@ -249,7 +225,7 @@ static void
|
||||
on_surface_changed (void *data)
|
||||
{
|
||||
GdkSurface *surface = data;
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (impl->tracking_damage)
|
||||
gdk_x11_surface_pre_damage (surface);
|
||||
@ -267,7 +243,7 @@ on_surface_changed (void *data)
|
||||
static void
|
||||
hook_surface_changed (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (impl->cairo_surface)
|
||||
{
|
||||
@ -284,7 +260,7 @@ hook_surface_changed (GdkSurface *surface)
|
||||
static void
|
||||
unhook_surface_changed (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (impl->cairo_surface)
|
||||
{
|
||||
@ -299,7 +275,7 @@ unhook_surface_changed (GdkSurface *surface)
|
||||
static void
|
||||
gdk_x11_surface_predict_presentation_time (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
GdkFrameClock *clock;
|
||||
GdkFrameTimings *timings;
|
||||
gint64 presentation_time;
|
||||
@ -346,11 +322,11 @@ static void
|
||||
gdk_x11_surface_begin_frame (GdkSurface *surface,
|
||||
gboolean force_frame)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (!SURFACE_IS_TOPLEVEL (surface) ||
|
||||
impl->toplevel->extended_update_counter == None)
|
||||
@ -387,11 +363,11 @@ gdk_x11_surface_end_frame (GdkSurface *surface)
|
||||
{
|
||||
GdkFrameClock *clock;
|
||||
GdkFrameTimings *timings;
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (!SURFACE_IS_TOPLEVEL (surface) ||
|
||||
impl->toplevel->extended_update_counter == None ||
|
||||
@ -428,7 +404,7 @@ gdk_x11_surface_end_frame (GdkSurface *surface)
|
||||
else
|
||||
impl->toplevel->current_counter_value += 1;
|
||||
|
||||
set_sync_counter(GDK_SURFACE_XDISPLAY (impl->wrapper),
|
||||
set_sync_counter(GDK_SURFACE_XDISPLAY (surface),
|
||||
impl->toplevel->extended_update_counter,
|
||||
impl->toplevel->current_counter_value);
|
||||
|
||||
@ -463,25 +439,22 @@ gdk_x11_surface_end_frame (GdkSurface *surface)
|
||||
*****************************************************/
|
||||
|
||||
static void
|
||||
gdk_surface_impl_x11_finalize (GObject *object)
|
||||
gdk_x11_surface_finalize (GObject *object)
|
||||
{
|
||||
GdkSurface *wrapper;
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE_IMPL_X11 (object));
|
||||
g_return_if_fail (GDK_IS_X11_SURFACE (object));
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (object);
|
||||
impl = GDK_X11_SURFACE (object);
|
||||
|
||||
wrapper = impl->wrapper;
|
||||
if (SURFACE_IS_TOPLEVEL (impl) && impl->toplevel->in_frame)
|
||||
unhook_surface_changed (GDK_SURFACE (impl));
|
||||
|
||||
if (SURFACE_IS_TOPLEVEL (wrapper) && impl->toplevel->in_frame)
|
||||
unhook_surface_changed (wrapper);
|
||||
_gdk_x11_surface_grab_check_destroy (GDK_SURFACE (impl));
|
||||
|
||||
_gdk_x11_surface_grab_check_destroy (wrapper);
|
||||
|
||||
if (!GDK_SURFACE_DESTROYED (wrapper))
|
||||
if (!GDK_SURFACE_DESTROYED (impl))
|
||||
{
|
||||
GdkDisplay *display = GDK_SURFACE_DISPLAY (wrapper);
|
||||
GdkDisplay *display = GDK_SURFACE_DISPLAY (GDK_SURFACE (impl));
|
||||
|
||||
_gdk_x11_display_remove_window (display, impl->xid);
|
||||
if (impl->toplevel && impl->toplevel->focus_window)
|
||||
@ -493,7 +466,7 @@ gdk_surface_impl_x11_finalize (GObject *object)
|
||||
if (impl->cursor)
|
||||
g_object_unref (impl->cursor);
|
||||
|
||||
G_OBJECT_CLASS (gdk_surface_impl_x11_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_x11_surface_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -708,7 +681,7 @@ setup_toplevel_window (GdkSurface *surface,
|
||||
GdkX11Screen *x11_screen)
|
||||
{
|
||||
GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface);
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
Display *xdisplay = GDK_SURFACE_XDISPLAY (surface);
|
||||
XID xid = GDK_SURFACE_XID (surface);
|
||||
@ -795,9 +768,9 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
|
||||
static void
|
||||
connect_frame_clock (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
if (SURFACE_IS_TOPLEVEL (surface) && !impl->frame_clock_connected)
|
||||
{
|
||||
GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
|
||||
@ -811,12 +784,18 @@ connect_frame_clock (GdkSurface *surface)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_x11_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent)
|
||||
GdkSurface *
|
||||
_gdk_x11_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkSurface *surface;
|
||||
GdkFrameClock *frame_clock;
|
||||
GdkX11Surface *impl;
|
||||
GdkX11Screen *x11_screen;
|
||||
GdkX11Display *display_x11;
|
||||
|
||||
@ -836,14 +815,27 @@ _gdk_x11_display_create_surface_impl (GdkDisplay *display,
|
||||
|
||||
display_x11 = GDK_X11_DISPLAY (display);
|
||||
x11_screen = GDK_X11_SCREEN (display_x11->screen);
|
||||
if (real_parent)
|
||||
xparent = GDK_SURFACE_XID (real_parent);
|
||||
if (parent)
|
||||
xparent = GDK_SURFACE_XID (parent);
|
||||
else
|
||||
xparent = GDK_SCREEN_XROOTWIN (x11_screen);
|
||||
|
||||
impl = g_object_new (GDK_TYPE_SURFACE_IMPL_X11, NULL);
|
||||
surface->impl = GDK_SURFACE_IMPL (impl);
|
||||
impl->wrapper = GDK_SURFACE (surface);
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
|
||||
surface = g_object_new (GDK_TYPE_X11_SURFACE,
|
||||
"display", display,
|
||||
"frame-clock", frame_clock,
|
||||
NULL);
|
||||
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
surface->surface_type = surface_type;
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
impl->surface_scale = x11_screen->surface_scale;
|
||||
|
||||
xdisplay = x11_screen->xdisplay;
|
||||
@ -933,6 +925,8 @@ _gdk_x11_display_create_surface_impl (GdkDisplay *display,
|
||||
connect_frame_clock (surface);
|
||||
|
||||
gdk_surface_freeze_toplevel_updates (surface);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -973,7 +967,7 @@ static void
|
||||
gdk_x11_surface_destroy (GdkSurface *surface,
|
||||
gboolean foreign_destroy)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
GdkToplevelX11 *toplevel;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
@ -1000,9 +994,9 @@ gdk_x11_surface_destroy (GdkSurface *surface,
|
||||
static void
|
||||
gdk_x11_surface_destroy_notify (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *surface_impl;
|
||||
GdkX11Surface *surface_impl;
|
||||
|
||||
surface_impl = GDK_SURFACE_IMPL_X11 ((surface)->impl);
|
||||
surface_impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (!GDK_SURFACE_DESTROYED (surface))
|
||||
{
|
||||
@ -1202,7 +1196,7 @@ set_initial_hints (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_show (GdkSurface *surface, gboolean already_mapped)
|
||||
gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkX11Display *display_x11;
|
||||
@ -1236,7 +1230,7 @@ gdk_surface_x11_show (GdkSurface *surface, gboolean already_mapped)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_withdraw (GdkSurface *surface)
|
||||
gdk_x11_surface_withdraw (GdkSurface *surface)
|
||||
{
|
||||
if (!surface->destroyed)
|
||||
{
|
||||
@ -1253,7 +1247,7 @@ gdk_surface_x11_withdraw (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_hide (GdkSurface *surface)
|
||||
gdk_x11_surface_hide (GdkSurface *surface)
|
||||
{
|
||||
/* We'll get the unmap notify eventually, and handle it then,
|
||||
* but checking here makes things more consistent if we are
|
||||
@ -1267,7 +1261,7 @@ gdk_surface_x11_hide (GdkSurface *surface)
|
||||
{
|
||||
case GDK_SURFACE_TOPLEVEL:
|
||||
case GDK_SURFACE_TEMP: /* ? */
|
||||
gdk_surface_x11_withdraw (surface);
|
||||
gdk_x11_surface_withdraw (surface);
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -1281,11 +1275,11 @@ gdk_surface_x11_hide (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static inline void
|
||||
surface_x11_move (GdkSurface *surface,
|
||||
x11_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
XMoveWindow (GDK_SURFACE_XDISPLAY (surface),
|
||||
GDK_SURFACE_XID (surface),
|
||||
@ -1299,11 +1293,11 @@ surface_x11_move (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static inline void
|
||||
surface_x11_resize (GdkSurface *surface,
|
||||
x11_surface_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
@ -1323,7 +1317,7 @@ surface_x11_resize (GdkSurface *surface,
|
||||
impl->unscaled_height = height * impl->surface_scale;
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
_gdk_x11_surface_update_size (GDK_SURFACE_IMPL_X11 (surface->impl));
|
||||
_gdk_x11_surface_update_size (GDK_X11_SURFACE (surface));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1333,13 +1327,13 @@ surface_x11_resize (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static inline void
|
||||
surface_x11_move_resize (GdkSurface *surface,
|
||||
x11_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
@ -1364,7 +1358,7 @@ surface_x11_move_resize (GdkSurface *surface,
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
|
||||
_gdk_x11_surface_update_size (GDK_SURFACE_IMPL_X11 (surface->impl));
|
||||
_gdk_x11_surface_update_size (GDK_X11_SURFACE (surface));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1374,7 +1368,7 @@ surface_x11_move_resize (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_move_resize (GdkSurface *surface,
|
||||
gdk_x11_surface_move_resize (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
@ -1382,13 +1376,13 @@ gdk_surface_x11_move_resize (GdkSurface *surface,
|
||||
gint height)
|
||||
{
|
||||
if (with_move && (width < 0 && height < 0))
|
||||
surface_x11_move (surface, x, y);
|
||||
x11_surface_move (surface, x, y);
|
||||
else
|
||||
{
|
||||
if (with_move)
|
||||
surface_x11_move_resize (surface, x, y, width, height);
|
||||
x11_surface_move_resize (surface, x, y, width, height);
|
||||
else
|
||||
surface_x11_resize (surface, width, height);
|
||||
x11_surface_resize (surface, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1396,11 +1390,11 @@ void
|
||||
_gdk_x11_surface_set_surface_scale (GdkSurface *surface,
|
||||
int scale)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
GdkToplevelX11 *toplevel;
|
||||
GdkSurfaceHints geom_mask;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
impl->surface_scale = scale;
|
||||
if (impl->cairo_surface)
|
||||
@ -1434,13 +1428,13 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_raise (GdkSurface *surface)
|
||||
gdk_x11_surface_raise (GdkSurface *surface)
|
||||
{
|
||||
XRaiseWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_restack_toplevel (GdkSurface *surface,
|
||||
gdk_x11_surface_restack_toplevel (GdkSurface *surface,
|
||||
GdkSurface *sibling,
|
||||
gboolean above)
|
||||
{
|
||||
@ -1455,7 +1449,7 @@ gdk_surface_x11_restack_toplevel (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_lower (GdkSurface *surface)
|
||||
gdk_x11_surface_lower (GdkSurface *surface)
|
||||
{
|
||||
XLowerWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface));
|
||||
}
|
||||
@ -1899,7 +1893,7 @@ gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
XSizeHints size_hints;
|
||||
GdkToplevelX11 *toplevel;
|
||||
|
||||
@ -2016,7 +2010,7 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
|
||||
GdkGeometry *geometry,
|
||||
GdkSurfaceHints *geom_mask)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
XSizeHints *size_hints;
|
||||
glong junk_supplied_mask = 0;
|
||||
|
||||
@ -2030,7 +2024,7 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
return;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
size_hints = XAllocSizeHints ();
|
||||
if (!size_hints)
|
||||
@ -2244,23 +2238,23 @@ gdk_x11_surface_set_transient_for (GdkSurface *surface,
|
||||
GdkCursor *
|
||||
_gdk_x11_surface_get_cursor (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
return impl->cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_get_geometry (GdkSurface *surface,
|
||||
gdk_x11_surface_get_geometry (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
Window root;
|
||||
gint tx;
|
||||
gint ty;
|
||||
@ -2271,7 +2265,7 @@ gdk_surface_x11_get_geometry (GdkSurface *surface,
|
||||
|
||||
if (!GDK_SURFACE_DESTROYED (surface))
|
||||
{
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
XGetGeometry (GDK_SURFACE_XDISPLAY (surface),
|
||||
GDK_SURFACE_XID (surface),
|
||||
@ -2289,13 +2283,13 @@ gdk_surface_x11_get_geometry (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_get_root_coords (GdkSurface *surface,
|
||||
gdk_x11_surface_get_root_coords (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *root_x,
|
||||
gint *root_y)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
Window child;
|
||||
gint tx;
|
||||
gint ty;
|
||||
@ -2317,7 +2311,7 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
|
||||
GdkRectangle *rect)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
Window xwindow;
|
||||
Window xparent;
|
||||
Window root;
|
||||
@ -2343,7 +2337,7 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
|
||||
rect->width = 1;
|
||||
rect->height = 1;
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
/* Refine our fallback answer a bit using local information */
|
||||
rect->x = surface->x * impl->surface_scale;
|
||||
@ -2481,7 +2475,7 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_surface_x11_get_device_state (GdkSurface *surface,
|
||||
gdk_x11_surface_get_device_state (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
@ -2501,13 +2495,13 @@ gdk_surface_x11_get_device_state (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_input_shape_combine_region (GdkSurface *surface,
|
||||
gdk_x11_surface_input_shape_combine_region (GdkSurface *surface,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
#ifdef ShapeInput
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
@ -2689,7 +2683,7 @@ gdk_x11_surface_set_shadow_width (GdkSurface *surface,
|
||||
int top,
|
||||
int bottom)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
Atom frame_extents;
|
||||
gulong data[4] = {
|
||||
left * impl->surface_scale,
|
||||
@ -3602,7 +3596,7 @@ wmspec_send_message (GdkDisplay *display,
|
||||
gint action,
|
||||
gint button)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
XClientMessageEvent xclient;
|
||||
|
||||
memset (&xclient, 0, sizeof (xclient));
|
||||
@ -3973,7 +3967,7 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
|
||||
guint button_mask = 0;
|
||||
GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display);
|
||||
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
||||
GdkSurfaceImplX11 *impl;
|
||||
GdkX11Surface *impl;
|
||||
|
||||
if (!mv_resize || !mv_resize->moveresize_surface)
|
||||
{
|
||||
@ -3981,7 +3975,7 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
impl = GDK_SURFACE_IMPL_X11 (mv_resize->moveresize_surface->impl);
|
||||
impl = GDK_X11_SURFACE (mv_resize->moveresize_surface);
|
||||
|
||||
if (mv_resize->moveresize_button != 0)
|
||||
button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1);
|
||||
@ -4294,7 +4288,7 @@ gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
return;
|
||||
|
||||
gdk_surface_x11_get_root_coords (surface, x, y, &root_x, &root_y);
|
||||
gdk_x11_surface_get_root_coords (surface, x, y, &root_x, &root_y);
|
||||
|
||||
/* Avoid EWMH for touch devices */
|
||||
if (_should_perform_ewmh_drag (surface, device))
|
||||
@ -4322,7 +4316,7 @@ gdk_x11_surface_begin_move_drag (GdkSurface *surface,
|
||||
else
|
||||
direction = _NET_WM_MOVERESIZE_MOVE;
|
||||
|
||||
gdk_surface_x11_get_root_coords (surface, x, y, &root_x, &root_y);
|
||||
gdk_x11_surface_get_root_coords (surface, x, y, &root_x, &root_y);
|
||||
|
||||
/* Avoid EWMH for touch devices */
|
||||
if (_should_perform_ewmh_drag (surface, device))
|
||||
@ -4454,13 +4448,13 @@ gdk_x11_get_server_time (GdkSurface *surface)
|
||||
XID
|
||||
gdk_x11_surface_get_xid (GdkSurface *surface)
|
||||
{
|
||||
return GDK_SURFACE_IMPL_X11 (surface->impl)->xid;
|
||||
return GDK_X11_SURFACE (surface)->xid;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_surface_get_scale_factor (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return 1;
|
||||
@ -4484,14 +4478,14 @@ void
|
||||
gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface,
|
||||
gboolean frame_sync_enabled)
|
||||
{
|
||||
GDK_SURFACE_IMPL_X11 (surface->impl)->frame_sync_enabled = FALSE;
|
||||
GDK_X11_SURFACE (surface)->frame_sync_enabled = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_set_opaque_region (GdkSurface *surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
GdkDisplay *display;
|
||||
int nitems;
|
||||
gulong *data;
|
||||
@ -4538,7 +4532,7 @@ static gboolean
|
||||
gdk_x11_surface_show_window_menu (GdkSurface *surface,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
||||
GdkDevice *device;
|
||||
int device_id;
|
||||
@ -4560,7 +4554,7 @@ gdk_x11_surface_show_window_menu (GdkSurface *surface,
|
||||
return FALSE;
|
||||
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
gdk_surface_x11_get_root_coords (surface, x, y, &x_root, &y_root);
|
||||
gdk_x11_surface_get_root_coords (surface, x, y, &x_root, &y_root);
|
||||
device = gdk_event_get_device (event);
|
||||
g_object_get (G_OBJECT (device),
|
||||
"device-id", &device_id,
|
||||
@ -4585,24 +4579,24 @@ gdk_x11_surface_show_window_menu (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_impl_x11_class_init (GdkSurfaceImplX11Class *klass)
|
||||
gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkSurfaceImplClass *impl_class = GDK_SURFACE_IMPL_CLASS (klass);
|
||||
GdkSurfaceClass *impl_class = GDK_SURFACE_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_surface_impl_x11_finalize;
|
||||
object_class->finalize = gdk_x11_surface_finalize;
|
||||
|
||||
impl_class->show = gdk_surface_x11_show;
|
||||
impl_class->hide = gdk_surface_x11_hide;
|
||||
impl_class->withdraw = gdk_surface_x11_withdraw;
|
||||
impl_class->raise = gdk_surface_x11_raise;
|
||||
impl_class->lower = gdk_surface_x11_lower;
|
||||
impl_class->restack_toplevel = gdk_surface_x11_restack_toplevel;
|
||||
impl_class->move_resize = gdk_surface_x11_move_resize;
|
||||
impl_class->get_geometry = gdk_surface_x11_get_geometry;
|
||||
impl_class->get_root_coords = gdk_surface_x11_get_root_coords;
|
||||
impl_class->get_device_state = gdk_surface_x11_get_device_state;
|
||||
impl_class->input_shape_combine_region = gdk_surface_x11_input_shape_combine_region;
|
||||
impl_class->show = gdk_x11_surface_show;
|
||||
impl_class->hide = gdk_x11_surface_hide;
|
||||
impl_class->withdraw = gdk_x11_surface_withdraw;
|
||||
impl_class->raise = gdk_x11_surface_raise;
|
||||
impl_class->lower = gdk_x11_surface_lower;
|
||||
impl_class->restack_toplevel = gdk_x11_surface_restack_toplevel;
|
||||
impl_class->move_resize = gdk_x11_surface_move_resize;
|
||||
impl_class->get_geometry = gdk_x11_surface_get_geometry;
|
||||
impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
|
||||
impl_class->get_device_state = gdk_x11_surface_get_device_state;
|
||||
impl_class->input_shape_combine_region = gdk_x11_surface_input_shape_combine_region;
|
||||
impl_class->destroy = gdk_x11_surface_destroy;
|
||||
impl_class->beep = gdk_x11_surface_beep;
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_SURFACE_X11_H__
|
||||
#define __GDK_SURFACE_X11_H__
|
||||
#ifndef __GDK_X11_SURFACE__
|
||||
#define __GDK_X11_SURFACE__
|
||||
|
||||
#include "gdk/x11/gdkprivate-x11.h"
|
||||
#include "gdk/gdksurfaceimpl.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkx11surface.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
@ -42,25 +42,11 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkToplevelX11 GdkToplevelX11;
|
||||
typedef struct _GdkSurfaceImplX11 GdkSurfaceImplX11;
|
||||
typedef struct _GdkSurfaceImplX11Class GdkSurfaceImplX11Class;
|
||||
typedef struct _GdkXPositionInfo GdkXPositionInfo;
|
||||
|
||||
/* Window implementation for X11
|
||||
*/
|
||||
|
||||
#define GDK_TYPE_SURFACE_IMPL_X11 (gdk_surface_impl_x11_get_type ())
|
||||
#define GDK_SURFACE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SURFACE_IMPL_X11, GdkSurfaceImplX11))
|
||||
#define GDK_SURFACE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SURFACE_IMPL_X11, GdkSurfaceImplX11Class))
|
||||
#define GDK_IS_SURFACE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SURFACE_IMPL_X11))
|
||||
#define GDK_IS_SURFACE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SURFACE_IMPL_X11))
|
||||
#define GDK_SURFACE_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE_IMPL_X11, GdkSurfaceImplX11Class))
|
||||
|
||||
struct _GdkSurfaceImplX11
|
||||
struct _GdkX11Surface
|
||||
{
|
||||
GdkSurfaceImpl parent_instance;
|
||||
|
||||
GdkSurface *wrapper;
|
||||
GdkSurface parent_instance;
|
||||
|
||||
Window xid;
|
||||
|
||||
@ -91,9 +77,9 @@ struct _GdkSurfaceImplX11
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _GdkSurfaceImplX11Class
|
||||
struct _GdkX11SurfaceClass
|
||||
{
|
||||
GdkSurfaceImplClass parent_class;
|
||||
GdkSurfaceClass parent_class;
|
||||
};
|
||||
|
||||
struct _GdkToplevelX11
|
||||
@ -184,13 +170,11 @@ struct _GdkToplevelX11
|
||||
#endif
|
||||
};
|
||||
|
||||
GType gdk_surface_impl_x11_get_type (void);
|
||||
|
||||
GdkToplevelX11 *_gdk_x11_surface_get_toplevel (GdkSurface *window);
|
||||
|
||||
GdkCursor *_gdk_x11_surface_get_cursor (GdkSurface *window);
|
||||
|
||||
void _gdk_x11_surface_update_size (GdkSurfaceImplX11 *impl);
|
||||
void _gdk_x11_surface_update_size (GdkX11Surface *impl);
|
||||
void _gdk_x11_surface_set_surface_scale (GdkSurface *window,
|
||||
int scale);
|
||||
|
||||
@ -198,4 +182,4 @@ void gdk_x11_surface_pre_damage (GdkSurface *surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_SURFACE_X11_H__ */
|
||||
#endif /* __GDK_X11_SURFACE__ */
|
||||
|
Loading…
Reference in New Issue
Block a user