Compare commits

...

12 Commits

Author SHA1 Message Date
Benjamin Otte
4cbce9ca23 display: Remove unused x/y/w/h form create_surface() vfunc 2021-03-31 04:21:32 +02:00
Benjamin Otte
51e7335cb7 macos: Use GdkSurface's scale factor 2021-03-31 04:14:16 +02:00
Benjamin Otte
be0535b3db broadway: Use scale factor of GdkSurface 2021-03-31 04:14:16 +02:00
Benjamin Otte
80cc453071 x11: Use GdkSurface's scale factor 2021-03-31 04:14:16 +02:00
Benjamin Otte
180626b697 surface: Add a private struct
... and put the (so far unused) scale factor there.
2021-03-31 04:14:16 +02:00
Benjamin Otte
76b4fff03d surface: Make gdk_surface_update_size() update the size
Only if the size changed of course.

Return a boolean to the backend indicating if it actually did so.

For now, we always notify the draw contexts, because the backends still
update the width/height themselves before calling update_size().
2021-03-31 04:14:16 +02:00
Benjamin Otte
13b45fe270 surface: Pass width/height/scale to update_size()
This is preparation for letting gdk_surface_update_size() actually do
the size updating.
2021-03-31 04:14:16 +02:00
Benjamin Otte
f855c52892 surface: Remove generic invalidation calls
These invalidations happen with the wrong sizes and need to be redone
after compute_size() anyway, so don't do them there.

Also, the idle handler happens _after_ we've already rendered in the
frame callback and just causes an unneeded redraw.
2021-03-31 04:14:16 +02:00
Benjamin Otte
e3ebdd633a window: Don't map children twice
Children get mapped when chaining up to the parent, so no need to do it
again.
2021-03-31 04:14:16 +02:00
Benjamin Otte
22797965de window: present() the toplevel only once
It needs to be done before mapping the children so that the toplevel is
visible when the children want to show popovers.
2021-03-31 04:14:16 +02:00
Benjamin Otte
13bd8e0dc2 gstmedia: Properly detect stream metadata when preparing
We can look at the GstPlayerMediaInfo to get all the info we care about.
2021-03-31 04:14:16 +02:00
Benjamin Otte
fce1479988 build: Define if options should be enabled or disbaled
"auto" options are terrible because nobody knows if they should enable
them or not. So enable the ones that every release should use and
disable the ones that releases aren't expected to use.

Everybody is still free to override this in their config - either to
turn off stuff that's unsupported or not wanted for them or to enable
new and exciting experimental features - but we should not leave this to
the randomly existing environment that somebpody happens to build in.

Options should be a deliberate choice every time.
2021-03-31 04:14:16 +02:00
29 changed files with 354 additions and 494 deletions

View File

@@ -107,11 +107,7 @@ void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
guint *height);
GdkSurface * _gdk_broadway_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface *parent);
GdkKeymap* _gdk_broadway_display_get_keymap (GdkDisplay *display);
void _gdk_broadway_display_consume_all_input (GdkDisplay *display);
BroadwayInputMsg * _gdk_broadway_display_block_for_input (GdkDisplay *display,

View File

@@ -211,11 +211,7 @@ disconnect_frame_clock (GdkSurface *surface)
GdkSurface *
_gdk_broadway_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
GdkSurface *parent)
{
GdkBroadwayDisplay *broadway_display;
GdkFrameClock *frame_clock;
@@ -252,16 +248,17 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
g_object_unref (frame_clock);
surface->parent = parent;
surface->x = x;
surface->y = y;
surface->width = width;
surface->height = height;
if (surface_type == GDK_SURFACE_TEMP)
{
surface->x = -100;
surface->y = -100;
}
broadway_display = GDK_BROADWAY_DISPLAY (display);
impl = GDK_BROADWAY_SURFACE (surface);
impl->root_x = x;
impl->root_y = y;
impl->root_x = 0;
impl->root_y = 0;
if (parent)
{
impl->root_x += GDK_BROADWAY_SURFACE (parent)->root_x;
@@ -408,19 +405,6 @@ gdk_broadway_surface_hide (GdkSurface *surface)
_gdk_surface_clear_update_area (surface);
}
static int
gdk_broadway_surface_get_scale_factor (GdkSurface *surface)
{
GdkBroadwayDisplay *broadway_display;
if (GDK_SURFACE_DESTROYED (surface))
return 1;
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
return broadway_display->scale_factor;
}
static void
sync_child_root_pos (GdkSurface *parent)
{
@@ -519,7 +503,7 @@ gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
if (size_changed)
{
surface->resize_count++;
_gdk_surface_update_size (surface);
gdk_surface_update_size (surface, surface->width, surface->height, broadway_display->scale_factor);
}
}
@@ -1113,8 +1097,7 @@ create_moveresize_surface (MoveResizeData *mv_resize,
mv_resize->moveresize_emulation_surface =
_gdk_broadway_display_create_surface (mv_resize->display,
GDK_SURFACE_TEMP,
NULL,
-100, -100, 1, 1);
NULL);
gdk_broadway_surface_show (mv_resize->moveresize_emulation_surface, FALSE);
@@ -1257,7 +1240,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
impl_class->beep = gdk_broadway_surface_beep;
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
impl_class->get_scale_factor = gdk_broadway_surface_get_scale_factor;
}
#define LAST_PROP 1

View File

@@ -1129,16 +1129,11 @@ _gdk_display_unpause_events (GdkDisplay *display)
GdkSurface *
gdk_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
GdkSurface *parent)
{
return GDK_DISPLAY_GET_CLASS (display)->create_surface (display,
surface_type,
parent,
x, y, width, height);
parent);
}
/**

View File

@@ -137,11 +137,7 @@ struct _GdkDisplayClass
GdkSurface * (*create_surface) (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface *parent);
GdkKeymap * (*get_keymap) (GdkDisplay *display);
@@ -205,11 +201,7 @@ void _gdk_display_pause_events (GdkDisplay *display
void _gdk_display_unpause_events (GdkDisplay *display);
GdkSurface * gdk_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface *parent);
gboolean gdk_display_make_gl_context_current (GdkDisplay *display,
GdkGLContext *context);

View File

@@ -86,6 +86,13 @@ enum {
LAST_PROP
};
typedef struct _GdkSurfacePrivate GdkSurfacePrivate;
struct _GdkSurfacePrivate
{
int scale_factor;
};
/* Global info */
static void gdk_surface_finalize (GObject *object);
@@ -112,7 +119,7 @@ static void gdk_surface_queue_set_is_mapped (GdkSurface *surface,
static guint signals[LAST_SIGNAL] = { 0 };
static GParamSpec *properties[LAST_PROP] = { NULL, };
G_DEFINE_ABSTRACT_TYPE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
static gboolean
gdk_surface_real_beep (GdkSurface *surface)
@@ -462,19 +469,19 @@ gdk_surface_event_marshallerv (GClosure *closure,
}
static void
gdk_surface_init (GdkSurface *surface)
gdk_surface_init (GdkSurface *self)
{
/* 0-initialization is good for all other fields. */
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
surface->state = 0;
surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
surface->width = 1;
surface->height = 1;
self->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
self->width = 1;
self->height = 1;
priv->scale_factor = 1;
surface->alpha = 255;
self->alpha = 255;
surface->device_cursor = g_hash_table_new_full (NULL, NULL,
NULL, g_object_unref);
self->device_cursor = g_hash_table_new_full (NULL, NULL,
NULL, g_object_unref);
}
static void
@@ -813,31 +820,51 @@ gdk_surface_get_property (GObject *object,
}
}
void
_gdk_surface_update_size (GdkSurface *surface)
gboolean
gdk_surface_update_size (GdkSurface *self,
int width,
int height,
int scale)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
GSList *l;
for (l = surface->draw_contexts; l; l = l->next)
if (self->width == width &&
self->height == height &&
priv->scale_factor == scale)
{
/* FIXME: Remove when all backends are updated */
for (l = self->draw_contexts; l; l = l->next)
gdk_draw_context_surface_resized (l->data);
return FALSE;
}
g_object_freeze_notify (G_OBJECT (self));
if (self->width != width)
{
self->width = width;
g_object_notify (G_OBJECT (self), "width");
}
if (self->height != height)
{
self->height = height;
g_object_notify (G_OBJECT (self), "height");
}
if (priv->scale_factor != scale)
{
priv->scale_factor = scale;
g_object_notify (G_OBJECT (self), "scale-factor");
}
for (l = self->draw_contexts; l; l = l->next)
gdk_draw_context_surface_resized (l->data);
g_object_notify (G_OBJECT (surface), "width");
g_object_notify (G_OBJECT (surface), "height");
}
g_object_thaw_notify (G_OBJECT (self));
static GdkSurface *
gdk_surface_new (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
{
return gdk_display_create_surface (display,
surface_type,
parent,
x, y, width, height);
return TRUE;
}
/**
@@ -853,8 +880,7 @@ gdk_surface_new_toplevel (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL,
NULL, 0, 0, 1, 1);
return gdk_display_create_surface (display, GDK_SURFACE_TOPLEVEL, NULL);
}
/**
@@ -877,8 +903,7 @@ gdk_surface_new_popup (GdkSurface *parent,
g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
surface = gdk_surface_new (parent->display, GDK_SURFACE_POPUP,
parent, 0, 0, 100, 100);
surface = gdk_display_create_surface (parent->display, GDK_SURFACE_POPUP, parent);
surface->autohide = autohide;
@@ -2364,7 +2389,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
* with it.
*/
cairo_surface_t *
gdk_surface_create_similar_surface (GdkSurface * surface,
gdk_surface_create_similar_surface (GdkSurface * surface,
cairo_content_t content,
int width,
int height)
@@ -2601,6 +2626,7 @@ gdk_surface_get_frame_clock (GdkSurface *surface)
int
gdk_surface_get_scale_factor (GdkSurface *surface)
{
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (surface);
GdkSurfaceClass *class;
g_return_val_if_fail (GDK_IS_SURFACE (surface), 1);
@@ -2612,7 +2638,7 @@ gdk_surface_get_scale_factor (GdkSurface *surface)
if (class->get_scale_factor)
return class->get_scale_factor (surface);
return 1;
return priv->scale_factor;
}
/**
@@ -2730,8 +2756,6 @@ set_is_mapped_idle (gpointer user_data)
G_SOURCE_REMOVE);
surface->is_mapped = surface->pending_is_mapped;
if (surface->is_mapped)
gdk_surface_invalidate_rect (surface, NULL);
g_object_notify (G_OBJECT (surface), "mapped");
@@ -2751,8 +2775,6 @@ gdk_surface_set_is_mapped (GdkSurface *surface,
was_mapped = surface->is_mapped;
surface->is_mapped = is_mapped;
if (surface->is_mapped)
gdk_surface_invalidate_rect (surface, NULL);
if (was_mapped != is_mapped)
g_object_notify (G_OBJECT (surface), "mapped");

View File

@@ -89,7 +89,8 @@ struct _GdkSurface
guint update_and_descendants_freeze_count;
int width, height;
int width;
int height;
GdkCursor *cursor;
GHashTable *device_cursor;
@@ -255,6 +256,11 @@ gdk_gravity_flip_vertically (GdkGravity anchor)
g_assert_not_reached ();
}
gboolean gdk_surface_update_size (GdkSurface *surface,
int width,
int height,
int scale);
void _gdk_surface_destroy (GdkSurface *surface,
gboolean foreign_destroy);
void gdk_surface_invalidate_rect (GdkSurface *surface,
@@ -262,7 +268,6 @@ void gdk_surface_invalidate_rect (GdkSurface *surface,
void gdk_surface_invalidate_region (GdkSurface *surface,
const cairo_region_t *region);
void _gdk_surface_clear_update_area (GdkSurface *surface);
void _gdk_surface_update_size (GdkSurface *surface);
GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
GError **error);

View File

@@ -256,7 +256,7 @@ typedef NSString *CALayerContentsGravity;
[[self contentView] setFrame:NSMakeRect (0, 0, surface->width, surface->height)];
_gdk_surface_update_size (surface);
gdk_surface_update_size (surface, surface->width, surface->height, [self backingScaleFactor]);
gdk_surface_request_layout (surface);

View File

@@ -597,11 +597,7 @@ _gdk_macos_display_surface_resigned_main (GdkMacosDisplay *self,
static GdkSurface *
gdk_macos_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
GdkSurface *parent)
{
GdkMacosDisplay *self = (GdkMacosDisplay *)display;
GdkMacosSurface *surface;
@@ -609,7 +605,7 @@ gdk_macos_display_create_surface (GdkDisplay *display,
g_assert (GDK_IS_MACOS_DISPLAY (self));
g_assert (!parent || GDK_IS_MACOS_SURFACE (parent));
surface = _gdk_macos_surface_new (self, surface_type, parent, x, y, width, height);
surface = _gdk_macos_surface_new (self, surface_type, parent);
if (surface != NULL)
_gdk_macos_display_surface_added (self, surface);

View File

@@ -72,11 +72,7 @@ struct _GdkMacosSurfaceClass
GdkMacosSurface *_gdk_macos_surface_new (GdkMacosDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface *parent);
NSWindow *_gdk_macos_surface_get_native (GdkMacosSurface *self);
CGDirectDisplayID _gdk_macos_surface_get_screen_id (GdkMacosSurface *self);
const char *_gdk_macos_surface_get_title (GdkMacosSurface *self);

View File

@@ -136,16 +136,6 @@ gdk_macos_surface_hide (GdkSurface *surface)
gdk_surface_freeze_updates (GDK_SURFACE (self));
}
static int
gdk_macos_surface_get_scale_factor (GdkSurface *surface)
{
GdkMacosSurface *self = (GdkMacosSurface *)surface;
g_assert (GDK_IS_MACOS_SURFACE (self));
return [self->window backingScaleFactor];
}
void
_gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
int top,
@@ -331,8 +321,7 @@ gdk_macos_surface_drag_begin (GdkSurface *surface,
_gdk_macos_surface_get_root_coords (GDK_MACOS_SURFACE (surface), &sx, &sy);
drag_surface = _gdk_macos_surface_new (GDK_MACOS_DISPLAY (surface->display),
GDK_SURFACE_TEMP,
surface,
-99, -99, 1, 1);
surface);
drag = g_object_new (GDK_TYPE_MACOS_DRAG,
"drag-surface", drag_surface,
"surface", surface,
@@ -501,7 +490,6 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
surface_class->get_device_state = gdk_macos_surface_get_device_state;
surface_class->get_geometry = gdk_macos_surface_get_geometry;
surface_class->get_root_coords = gdk_macos_surface_get_root_coords;
surface_class->get_scale_factor = gdk_macos_surface_get_scale_factor;
surface_class->hide = gdk_macos_surface_hide;
surface_class->set_input_region = gdk_macos_surface_set_input_region;
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
@@ -525,13 +513,9 @@ gdk_macos_surface_init (GdkMacosSurface *self)
}
GdkMacosSurface *
_gdk_macos_surface_new (GdkMacosDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
_gdk_macos_surface_new (GdkMacosDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent)
{
GdkFrameClock *frame_clock;
GdkMacosSurface *ret;
@@ -546,15 +530,15 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
switch (surface_type)
{
case GDK_SURFACE_TOPLEVEL:
ret = _gdk_macos_toplevel_surface_new (display, parent, frame_clock, x, y, width, height);
ret = _gdk_macos_toplevel_surface_new (display, parent, frame_clock);
break;
case GDK_SURFACE_POPUP:
ret = _gdk_macos_popup_surface_new (display, parent, frame_clock, x, y, width, height);
ret = _gdk_macos_popup_surface_new (display, parent, frame_clock);
break;
case GDK_SURFACE_TEMP:
ret = _gdk_macos_drag_surface_new (display, frame_clock, x, y, width, height);
ret = _gdk_macos_drag_surface_new (display, frame_clock, x, y);
break;
default:

View File

@@ -1039,7 +1039,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 = _gdk_wayland_display_create_surface;
display_class->create_surface = gdk_wayland_display_create_surface;
display_class->get_keymap = _gdk_wayland_display_get_keymap;
display_class->make_gl_context_current = gdk_wayland_display_make_gl_context_current;

View File

@@ -121,13 +121,9 @@ void gdk_wayland_drop_set_source_actions (GdkDrop
void gdk_wayland_drop_set_action (GdkDrop *drop,
uint32_t action);
GdkSurface * _gdk_wayland_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface * gdk_wayland_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent);
void _gdk_wayland_display_create_seat (GdkWaylandDisplay *display,
guint32 id,

View File

@@ -438,7 +438,7 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
if (scale_changed)
g_object_notify (G_OBJECT (surface), "scale-factor");
_gdk_surface_update_size (surface);
gdk_surface_update_size (surface, surface->width, surface->height, impl->scale);
}
static const char *
@@ -803,13 +803,9 @@ static void gdk_wayland_surface_set_title (GdkSurface *surface,
const char *title);
GdkSurface *
_gdk_wayland_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
gdk_wayland_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
GdkSurface *surface;
@@ -852,22 +848,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
impl = GDK_WAYLAND_SURFACE (surface);
if (width > 65535)
{
g_warning ("Native Surfaces wider than 65535 pixels are not supported");
width = 65535;
}
if (height > 65535)
{
g_warning ("Native Surfaces taller than 65535 pixels are not supported");
height = 65535;
}
surface->x = x;
surface->y = y;
surface->width = width;
surface->height = height;
g_object_ref (surface);
/* More likely to be right than just assuming 1 */
@@ -4696,10 +4676,9 @@ create_dnd_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = _gdk_wayland_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL,
0, 0, 100, 100);
surface = gdk_wayland_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL);
GDK_WAYLAND_SURFACE (surface)->is_drag_surface = TRUE;
return surface;

View File

@@ -428,10 +428,9 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
#endif
/* Create a dummy window to receive wintab events */
wintab_window =
_gdk_win32_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL,
-100, -100, 2, 2);
gdk_win32_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL);
g_object_ref (wintab_window);

View File

@@ -1169,7 +1169,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->get_next_serial = gdk_win32_display_get_next_serial;
display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
display_class->create_surface = _gdk_win32_display_create_surface;
display_class->create_surface = gdk_win32_display_create_surface;
display_class->get_keymap = _gdk_win32_display_get_keymap;
display_class->make_gl_context_current = _gdk_win32_display_make_gl_context_current;

View File

@@ -1700,10 +1700,9 @@ create_drag_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = _gdk_win32_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL,
0, 0, 100, 100);
surface = gdk_win32_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL);
return surface;
}

View File

@@ -379,13 +379,9 @@ void _gdk_win32_keymap_set_active_layout (GdkWin32Keymap *keymap,
GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
GdkSurface *_gdk_win32_display_create_surface (GdkDisplay *display,
GdkSurface *gdk_win32_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface *parent);
/* stray GdkSurfaceImplWin32 members */
void _gdk_win32_surface_register_dnd (GdkSurface *window);

View File

@@ -449,13 +449,9 @@ RegisterGdkClass (GdkSurfaceType wtype)
* [1] http://mail.gnome.org/archives/gtk-devel-list/2010-August/msg00214.html
*/
GdkSurface *
_gdk_win32_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
gdk_win32_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent)
{
HWND hwndNew;
HANDLE owner;
@@ -467,11 +463,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
GdkSurface *surface;
const char *title;
wchar_t *wtitle;
int window_width, window_height;
int window_x, window_y;
int offset_x = 0, offset_y = 0;
int real_x = 0, real_y = 0;
GdkFrameClock *frame_clock;
int x, y;
g_return_val_if_fail (display == _gdk_display, NULL);
@@ -494,6 +487,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
"display", display,
"frame-clock", frame_clock,
NULL);
x = CW_USEDEFAULT;
y = CW_USEDEFAULT;
break;
case GDK_SURFACE_POPUP:
impl = g_object_new (GDK_TYPE_WIN32_POPUP,
@@ -501,12 +496,16 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
"display", display,
"frame-clock", frame_clock,
NULL);
x = 0;
y = 0;
break;
case GDK_SURFACE_TEMP:
impl = g_object_new (GDK_TYPE_WIN32_DRAG_SURFACE,
"display", display,
"frame-clock", frame_clock,
NULL);
x = -100;
y = -100;
break;
default:
g_assert_not_reached ();
@@ -514,18 +513,12 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
}
surface = GDK_SURFACE (impl);
surface->x = x;
surface->y = y;
surface->width = width;
surface->height = height;
impl->surface_scale = _gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL, NULL);
dwExStyle = 0;
owner = NULL;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
/* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
@@ -550,32 +543,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
g_assert_not_reached ();
}
rect.left = x * impl->surface_scale;
rect.top = y * impl->surface_scale;
rect.right = rect.left + width * impl->surface_scale;
rect.bottom = rect.top + height * impl->surface_scale;
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
real_x = (x - offset_x) * impl->surface_scale;
real_y = (y - offset_y) * impl->surface_scale;
if (surface_type == GDK_SURFACE_TOPLEVEL)
{
/* We initially place it at default so that we can get the
default window positioning if we want */
window_x = window_y = CW_USEDEFAULT;
}
else
{
/* TEMP: Put these where requested */
window_x = real_x;
window_y = real_y;
}
window_width = rect.right - rect.left;
window_height = rect.bottom - rect.top;
title = get_default_title ();
if (!title || !*title)
title = "";
@@ -594,8 +561,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
MAKEINTRESOURCEW (klass),
wtitle,
dwStyle,
window_x, window_y,
window_width, window_height,
x, y,
CW_USEDEFAULT, CW_USEDEFAULT,
owner,
NULL,
_gdk_dll_hinstance,
@@ -606,15 +573,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
impl->initial_x = rect.left;
impl->initial_y = rect.top;
/* Now we know the initial position, move to actually specified position */
if (real_x != window_x || real_y != window_y)
{
API_CALL (SetWindowPos, (hwndNew,
SWP_NOZORDER_SPECIFIED,
real_x, real_y, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
}
g_object_ref (impl);
/* Take note: we're inserting a pointer into a heap-allocated
* object (impl). Inserting a pointer to a stack variable
@@ -626,11 +584,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
*/
gdk_win32_handle_table_insert (&GDK_SURFACE_HWND (impl), impl);
GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d@%+d%+d %p = %p\n",
GDK_NOTE (MISC, g_print ("... \"%s\" %p = %p\n",
title,
window_width, window_height,
surface->x - offset_x,
surface->y - offset_y,
owner,
hwndNew));
@@ -4583,7 +4538,7 @@ _gdk_win32_surface_compute_size (GdkSurface *surface)
surface->width = impl->next_layout.configured_width;
surface->height = impl->next_layout.configured_height;
_gdk_surface_update_size (surface);
gdk_surface_update_size (surface, surface->width, surface->height, gdk_surface_get_scale_factor (surface));
}
return FALSE;

View File

@@ -228,7 +228,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
else
{
xwindow = GDK_SURFACE_XID (surface);
scale = GDK_X11_SURFACE (surface)->surface_scale;
scale = gdk_surface_get_scale_factor (surface);
}
if (!GDK_X11_DISPLAY (display)->trusted_client ||
@@ -357,7 +357,6 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
double *win_y,
GdkModifierType *mask)
{
GdkX11Surface *impl;
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
GdkDisplay *display;
GdkX11Screen *screen;
@@ -369,6 +368,7 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
XIModifierState mod_state;
XIGroupState group_state;
Bool retval;
int scale;
display = gdk_device_get_display (device);
screen = GDK_X11_DISPLAY (display)->screen;
@@ -501,12 +501,13 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
gdk_x11_display_ungrab (display);
scale = 1;
if (gdk_x11_display_error_trap_pop (display) == 0)
{
surface = gdk_x11_surface_lookup_for_display (display, last);
impl = NULL;
if (surface)
impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
if (mask)
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
@@ -522,10 +523,10 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
}
if (win_x)
*win_x = (surface) ? (xwin_x / impl->surface_scale) : -1;
*win_x = (surface) ? (xwin_x / scale) : -1;
if (win_y)
*win_y = (surface) ? (xwin_y / impl->surface_scale) : -1;
*win_y = (surface) ? (xwin_y / scale) : -1;
return surface;

View File

@@ -1448,7 +1448,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
const XGenericEventCookie *cookie;
GdkDevice *device, *source_device;
GdkSurface *surface;
GdkX11Surface *impl;
int scale;
XIEvent *ev;
GdkEvent *event;
@@ -1475,10 +1474,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
scale = 1;
if (surface)
{
impl = GDK_X11_SURFACE (surface);
scale = impl->surface_scale;
}
scale = gdk_surface_get_scale_factor (surface);
if (ev->evtype == XI_Motion ||
ev->evtype == XI_ButtonRelease)

View File

@@ -625,6 +625,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkToplevelX11 *toplevel = NULL;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
GdkEvent *event;
int scale = 1;
event = NULL;
@@ -644,6 +645,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
x11_screen = GDK_SURFACE_SCREEN (surface);
toplevel = _gdk_x11_surface_get_toplevel (surface);
surface_impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
g_object_ref (surface);
}
@@ -701,13 +703,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkRectangle expose_rect;
int x2, y2;
expose_rect.x = xevent->xexpose.x / surface_impl->surface_scale;
expose_rect.y = xevent->xexpose.y / surface_impl->surface_scale;
expose_rect.x = xevent->xexpose.x / scale;
expose_rect.y = xevent->xexpose.y / scale;
x2 = (xevent->xexpose.x + xevent->xexpose.width + surface_impl->surface_scale -1) / surface_impl->surface_scale;
x2 = (xevent->xexpose.x + xevent->xexpose.width + scale -1) / scale;
expose_rect.width = x2 - expose_rect.x;
y2 = (xevent->xexpose.y + xevent->xexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
y2 = (xevent->xexpose.y + xevent->xexpose.height + scale -1) / scale;
expose_rect.height = y2 - expose_rect.y;
gdk_surface_invalidate_rect (surface, &expose_rect);
@@ -727,13 +729,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (surface == NULL)
break;
expose_rect.x = xevent->xgraphicsexpose.x / surface_impl->surface_scale;
expose_rect.y = xevent->xgraphicsexpose.y / surface_impl->surface_scale;
expose_rect.x = xevent->xgraphicsexpose.x / scale;
expose_rect.y = xevent->xgraphicsexpose.y / scale;
x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + surface_impl->surface_scale -1) / surface_impl->surface_scale;
x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + scale -1) / scale;
expose_rect.width = x2 - expose_rect.x;
y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + scale -1) / scale;
expose_rect.height = y2 - expose_rect.y;
gdk_surface_invalidate_rect (surface, &expose_rect);
@@ -906,11 +908,11 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
int new_abs_x, new_abs_y;
configured_width =
(xevent->xconfigure.width + surface_impl->surface_scale - 1) /
surface_impl->surface_scale;
(xevent->xconfigure.width + scale - 1) /
scale;
configured_height =
(xevent->xconfigure.height + surface_impl->surface_scale - 1) /
surface_impl->surface_scale;
(xevent->xconfigure.height + scale - 1) /
scale;
if (!xevent->xconfigure.send_event &&
!xevent->xconfigure.override_redirect &&
@@ -929,15 +931,15 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
&tx, &ty,
&child_window))
{
x = tx / surface_impl->surface_scale;
y = ty / surface_impl->surface_scale;
x = tx / scale;
y = ty / scale;
}
gdk_x11_display_error_trap_pop_ignored (display);
}
else
{
x = xevent->xconfigure.x / surface_impl->surface_scale;
y = xevent->xconfigure.y / surface_impl->surface_scale;
x = xevent->xconfigure.x / scale;
y = xevent->xconfigure.y / scale;
}
new_abs_x = x;
@@ -1432,11 +1434,9 @@ gdk_x11_display_open (const char *display_name)
gdk_event_init (display);
display_x11->leader_gdk_surface =
_gdk_x11_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL,
-100, -100, 1, 1);
display_x11->leader_gdk_surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL);
(_gdk_x11_surface_get_toplevel (display_x11->leader_gdk_surface))->is_leader = TRUE;
@@ -2936,7 +2936,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 = _gdk_x11_display_create_surface;
display_class->create_surface = gdk_x11_display_create_surface;
display_class->get_keymap = gdk_x11_display_get_keymap;
display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;

View File

@@ -536,19 +536,18 @@ gdk_surface_cache_new (GdkDisplay *display)
{
GList *toplevel_windows, *list;
GdkSurface *surface;
GdkX11Surface *impl;
int x, y, width, height;
int scale;
toplevel_windows = gdk_x11_display_get_toplevel_windows (display);
for (list = toplevel_windows; list; list = list->next)
{
surface = GDK_SURFACE (list->data);
impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (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,
width * impl->surface_scale,
height * impl->surface_scale,
x * scale, y * scale,
width * scale, height * scale,
gdk_surface_get_mapped (surface));
}
return result;
@@ -1284,10 +1283,9 @@ create_drag_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = _gdk_x11_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL,
0, 0, 100, 100);
surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL);
return surface;
}
@@ -2025,10 +2023,9 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
display = gdk_surface_get_display (surface);
ipc_surface = _gdk_x11_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL,
-99, -99, 1, 1);
ipc_surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_TEMP,
NULL);
drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG,
"surface", ipc_surface,

View File

@@ -641,6 +641,7 @@ xdnd_position_filter (GdkSurface *surface,
GdkX11Display *display_x11;
GdkDrop *drop;
GdkX11Drop *drop_x11;
int scale;
display = gdk_surface_get_display (surface);
display_x11 = GDK_X11_DISPLAY (display);
@@ -657,12 +658,13 @@ xdnd_position_filter (GdkSurface *surface,
{
surface = gdk_drop_get_surface (drop);
impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
drop_x11->suggested_action = xdnd_action_from_atom (display, action);
gdk_x11_drop_update_actions (drop_x11);
drop_x11->last_x = x_root / impl->surface_scale;
drop_x11->last_y = y_root / impl->surface_scale;
drop_x11->last_x = x_root / scale;
drop_x11->last_y = y_root / scale;
if (drop_x11->enter_emitted)
{

View File

@@ -176,13 +176,9 @@ void _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
GdkSurface * _gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height);
GdkSurface * gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent);
GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display);
void _gdk_x11_precache_atoms (GdkDisplay *display,

View File

@@ -148,7 +148,6 @@ GType gdk_x11_drag_surface_get_type (void) G_GNUC_CONST;
static void
gdk_x11_surface_init (GdkX11Surface *impl)
{
impl->surface_scale = 1;
impl->frame_sync_enabled = TRUE;
impl->surface_is_on_monitor = NULL;
}
@@ -198,17 +197,9 @@ gdk_x11_surface_update_size (GdkX11Surface *self,
{
GdkSurface *surface = GDK_SURFACE (self);
if (surface->width == width &&
surface->height == height &&
self->surface_scale == scale)
if (!gdk_surface_update_size (surface, width, height, scale))
return FALSE;
surface->width = width;
surface->height = height;
self->surface_scale = scale;
_gdk_surface_update_size (surface);
if (self->cairo_surface)
{
cairo_xlib_surface_set_size (self->cairo_surface,
@@ -229,6 +220,7 @@ update_shadow_size (GdkSurface *surface,
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
Atom frame_extents;
gulong data[4];
int scale;
if (impl->shadow_left == shadow_left &&
impl->shadow_right == shadow_right &&
@@ -241,10 +233,11 @@ update_shadow_size (GdkSurface *surface,
impl->shadow_top = shadow_top;
impl->shadow_bottom = shadow_bottom;
data[0] = shadow_left * impl->surface_scale;
data[1] = shadow_right * impl->surface_scale;
data[2] = shadow_top * impl->surface_scale;
data[3] = shadow_bottom * impl->surface_scale;
scale = gdk_surface_get_scale_factor (surface);
data[0] = shadow_left * scale;
data[1] = shadow_right * scale;
data[2] = shadow_top * scale;
data[3] = shadow_bottom * scale;
frame_extents = gdk_x11_get_xatom_by_name_for_display (gdk_surface_get_display (surface),
"_GTK_FRAME_EXTENTS");
@@ -399,7 +392,7 @@ gdk_x11_surface_compute_size (GdkSurface *surface)
gdk_x11_surface_update_size (impl,
impl->next_layout.configured_width,
impl->next_layout.configured_height,
impl->surface_scale);
gdk_surface_get_scale_factor (surface));
}
impl->next_layout.surface_geometry_dirty = FALSE;
@@ -410,7 +403,7 @@ gdk_x11_surface_compute_size (GdkSurface *surface)
gdk_x11_surface_update_size (impl,
impl->next_layout.configured_width,
impl->next_layout.configured_height,
impl->surface_scale);
gdk_surface_get_scale_factor (surface));
impl->next_layout.surface_geometry_dirty = FALSE;
}
@@ -986,7 +979,6 @@ setup_toplevel_window (GdkSurface *surface,
GdkX11Screen *x11_screen)
{
GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface);
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);
@@ -1010,8 +1002,8 @@ setup_toplevel_window (GdkSurface *surface,
* correct value???
*/
size_hints.flags = PSize;
size_hints.width = surface->width * impl->surface_scale;
size_hints.height = surface->height * impl->surface_scale;
size_hints.width = surface->width * gdk_surface_get_scale_factor (surface);
size_hints.height = surface->height * gdk_surface_get_scale_factor (surface);
XSetWMNormalHints (xdisplay, xid, &size_hints);
@@ -1152,13 +1144,9 @@ static void gdk_x11_surface_set_type_hint (GdkSurface *surface,
GdkSurfaceTypeHint hint);
GdkSurface *
_gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
int height)
gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent)
{
GdkSurface *surface;
GdkFrameClock *frame_clock;
@@ -1209,6 +1197,8 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
"display", display,
"frame-clock", frame_clock,
NULL);
surface->x = -100;
surface->y = -100;
break;
default:
g_assert_not_reached ();
@@ -1217,13 +1207,7 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
g_object_unref (frame_clock);
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;
@@ -1260,28 +1244,13 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
depth = gdk_x11_display_get_window_depth (display_x11);
if (surface->width * impl->surface_scale > 32767 ||
surface->height * impl->surface_scale > 32767)
{
g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
if (surface->width * impl->surface_scale > 32767)
surface->width = 32767 / impl->surface_scale;
if (surface->height * impl->surface_scale > 32767)
surface->height = 32767 / impl->surface_scale;
}
impl->unscaled_width = surface->width * impl->surface_scale;
impl->unscaled_height = surface->height * impl->surface_scale;
abs_x = 0;
abs_y = 0;
impl->xid = XCreateWindow (xdisplay, xparent,
(surface->x + abs_x) * impl->surface_scale,
(surface->y + abs_y) * impl->surface_scale,
MAX (1, surface->width * impl->surface_scale),
MAX (1, surface->height * impl->surface_scale),
(surface->x + abs_x),
(surface->y + abs_y),
1, 1,
0, depth, class, xvisual,
xattributes_mask, &xattributes);
@@ -1650,10 +1619,13 @@ x11_surface_move (GdkSurface *surface,
int y)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
int scale;
scale = gdk_surface_get_scale_factor (surface);
XMoveWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
x * impl->surface_scale, y * impl->surface_scale);
x * scale, y * scale);
if (impl->override_redirect)
{
@@ -1682,6 +1654,7 @@ x11_surface_resize (GdkSurface *surface,
int height)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
int scale;
if (width < 1)
width = 1;
@@ -1689,16 +1662,17 @@ x11_surface_resize (GdkSurface *surface,
if (height < 1)
height = 1;
scale = gdk_surface_get_scale_factor (surface);
gdk_x11_surface_pre_damage (surface);
XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
width * impl->surface_scale, height * impl->surface_scale);
width * scale, height * scale);
if (impl->override_redirect)
{
impl->unscaled_width = width * impl->surface_scale;
impl->unscaled_height = height * impl->surface_scale;
impl->unscaled_width = width * scale;
impl->unscaled_height = height * scale;
impl->next_layout.configured_width = width;
impl->next_layout.configured_height = height;
impl->next_layout.surface_geometry_dirty = TRUE;
@@ -1706,8 +1680,8 @@ x11_surface_resize (GdkSurface *surface,
}
else
{
if (width * impl->surface_scale != impl->unscaled_width ||
height * impl->surface_scale != impl->unscaled_height)
if (width * scale != impl->unscaled_width ||
height * scale != impl->unscaled_height)
{
surface->resize_count++;
if (surface->resize_count == 1)
@@ -1724,6 +1698,7 @@ x11_surface_move_resize (GdkSurface *surface,
int height)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
int scale;
if (width < 1)
width = 1;
@@ -1731,20 +1706,22 @@ x11_surface_move_resize (GdkSurface *surface,
if (height < 1)
height = 1;
scale = gdk_surface_get_scale_factor (surface);
gdk_x11_surface_pre_damage (surface);
XMoveResizeWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
x * impl->surface_scale, y * impl->surface_scale,
width * impl->surface_scale, height * impl->surface_scale);
x * scale, y * scale,
width * scale, height * scale);
if (impl->override_redirect)
{
impl->abs_x = x;
impl->abs_y = y;
impl->unscaled_width = width * impl->surface_scale;
impl->unscaled_height = height * impl->surface_scale;
impl->unscaled_width = width * scale;
impl->unscaled_height = height * scale;
impl->next_layout.configured_width = width;
impl->next_layout.configured_height = height;
impl->next_layout.surface_geometry_dirty = TRUE;
@@ -1763,8 +1740,8 @@ x11_surface_move_resize (GdkSurface *surface,
}
else
{
if (width * impl->surface_scale != impl->unscaled_width ||
height * impl->surface_scale != impl->unscaled_height)
if (width * scale != impl->unscaled_width ||
height * scale != impl->unscaled_height)
{
surface->resize_count++;
if (surface->resize_count == 1)
@@ -2017,18 +1994,16 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
if (impl->override_redirect)
{
impl->unscaled_width = surface->width * impl->surface_scale;
impl->unscaled_height = surface->height * impl->surface_scale;
impl->unscaled_width = surface->width * scale;
impl->unscaled_height = surface->height * scale;
}
XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
surface->width * impl->surface_scale,
surface->height * impl->surface_scale);
surface->width * scale,
surface->height * scale);
gdk_surface_invalidate_rect (surface, NULL);
g_object_notify (G_OBJECT (surface), "scale-factor");
}
void
@@ -2416,17 +2391,18 @@ gdk_x11_surface_set_urgency_hint (GdkSurface *surface,
}
static void
gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
const GdkGeometry *geometry,
GdkSurfaceHints geom_mask)
GdkSurfaceHints geom_mask)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
XSizeHints size_hints;
GdkToplevelX11 *toplevel;
int scale;
if (GDK_SURFACE_DESTROYED (surface))
return;
scale = gdk_surface_get_scale_factor (surface);
toplevel = _gdk_x11_surface_get_toplevel (surface);
if (toplevel)
{
@@ -2448,22 +2424,22 @@ gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
if (geom_mask & GDK_HINT_MIN_SIZE)
{
size_hints.flags |= PMinSize;
size_hints.min_width = geometry->min_width * impl->surface_scale;
size_hints.min_height = geometry->min_height * impl->surface_scale;
size_hints.min_width = geometry->min_width * scale;
size_hints.min_height = geometry->min_height * scale;
}
if (geom_mask & GDK_HINT_MAX_SIZE)
{
size_hints.flags |= PMaxSize;
size_hints.max_width = MAX (geometry->max_width, 1) * impl->surface_scale;
size_hints.max_height = MAX (geometry->max_height, 1) * impl->surface_scale;
size_hints.max_width = MAX (geometry->max_width, 1) * scale;
size_hints.max_height = MAX (geometry->max_height, 1) * scale;
}
else if (impl->surface_scale > 1)
else if (scale > 1)
{
size_hints.flags |= PResizeInc;
size_hints.width_inc = impl->surface_scale;
size_hints.height_inc = impl->surface_scale;
size_hints.width_inc = scale;
size_hints.height_inc = scale;
}
/* FIXME: Would it be better to delete this property if
@@ -2476,12 +2452,12 @@ gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
static void
gdk_surface_get_geometry_hints (GdkSurface *surface,
GdkGeometry *geometry,
GdkSurfaceHints *geom_mask)
GdkGeometry *geometry,
GdkSurfaceHints *geom_mask)
{
GdkX11Surface *impl;
XSizeHints *size_hints;
glong junk_supplied_mask = 0;
int scale;
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (geometry != NULL);
@@ -2492,7 +2468,7 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
if (GDK_SURFACE_DESTROYED (surface))
return;
impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
size_hints = XAllocSizeHints ();
if (!size_hints)
@@ -2507,15 +2483,15 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
if (size_hints->flags & PMinSize)
{
*geom_mask |= GDK_HINT_MIN_SIZE;
geometry->min_width = size_hints->min_width / impl->surface_scale;
geometry->min_height = size_hints->min_height / impl->surface_scale;
geometry->min_width = size_hints->min_width / scale;
geometry->min_height = size_hints->min_height / scale;
}
if (size_hints->flags & PMaxSize)
{
*geom_mask |= GDK_HINT_MAX_SIZE;
geometry->max_width = MAX (size_hints->max_width, 1) / impl->surface_scale;
geometry->max_height = MAX (size_hints->max_height, 1) / impl->surface_scale;
geometry->max_width = MAX (size_hints->max_width, 1) / scale;
geometry->max_height = MAX (size_hints->max_height, 1) / scale;
}
XFree (size_hints);
@@ -2699,12 +2675,11 @@ _gdk_x11_surface_get_cursor (GdkSurface *surface)
static void
gdk_x11_surface_get_geometry (GdkSurface *surface,
int *x,
int *y,
int *width,
int *height)
int *x,
int *y,
int *width,
int *height)
{
GdkX11Surface *impl;
Window root;
int tx;
int ty;
@@ -2712,23 +2687,24 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
guint theight;
guint tborder_width;
guint tdepth;
int scale;
if (!GDK_SURFACE_DESTROYED (surface))
{
impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
XGetGeometry (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
if (x)
*x = tx / impl->surface_scale;
*x = tx / scale;
if (y)
*y = ty / impl->surface_scale;
*y = ty / scale;
if (width)
*width = twidth / impl->surface_scale;
*width = twidth / scale;
if (height)
*height = theight / impl->surface_scale;
*height = theight / scale;
}
}
@@ -2739,26 +2715,28 @@ gdk_x11_surface_get_root_coords (GdkSurface *surface,
int *root_x,
int *root_y)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
Window child;
int scale;
int tx;
int ty;
scale = gdk_surface_get_scale_factor (surface);
XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
GDK_SURFACE_XROOTWIN (surface),
x * impl->surface_scale, y * impl->surface_scale, &tx, &ty,
x * scale, y * scale, &tx, &ty,
&child);
if (root_x)
*root_x = tx / impl->surface_scale;
*root_x = tx / scale;
if (root_y)
*root_y = ty / impl->surface_scale;
*root_y = ty / scale;
}
static void
gdk_x11_surface_get_frame_extents (GdkSurface *surface,
GdkRectangle *rect)
gdk_x11_surface_get_frame_extents (GdkSurface *surface,
GdkRectangle *rect)
{
GdkDisplay *display;
GdkX11Surface *impl;
@@ -2779,6 +2757,7 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
guint ww, wh, wb, wd;
int wx, wy;
gboolean got_frame_extents = FALSE;
int scale;
g_return_if_fail (rect != NULL);
@@ -2788,12 +2767,13 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
rect->height = 1;
impl = GDK_X11_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
/* Refine our fallback answer a bit using local information */
rect->x = impl->abs_x * impl->surface_scale;
rect->y = impl->abs_y * impl->surface_scale;
rect->width = surface->width * impl->surface_scale;
rect->height = surface->height * impl->surface_scale;
rect->x = impl->abs_x * scale;
rect->y = impl->abs_y * scale;
rect->width = surface->width * scale;
rect->height = surface->height * scale;
if (GDK_SURFACE_DESTROYED (surface) || impl->override_redirect)
return;
@@ -2917,10 +2897,10 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
as well as round the size up when we divide by scale so that the returned
size is guaranteed to cover the real pixels, but it may overshoot a bit
in case the window is not positioned/sized according to the scale */
rect->width = (rect->width + rect->x % impl->surface_scale + impl->surface_scale - 1) / impl->surface_scale;
rect->height = (rect->height + rect->y % impl->surface_scale + impl->surface_scale - 1) / impl->surface_scale;
rect->x = rect->x / impl->surface_scale;
rect->y = rect->y / impl->surface_scale;
rect->width = (rect->width + rect->x % scale + scale - 1) / scale;
rect->height = (rect->height + rect->y % scale + scale - 1) / scale;
rect->x = rect->x / scale;
rect->y = rect->y / scale;
gdk_x11_display_error_trap_pop_ignored (display);
}
@@ -2944,8 +2924,6 @@ gdk_x11_surface_set_input_region (GdkSurface *surface,
cairo_region_t *input_region)
{
#ifdef ShapeInput
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
if (GDK_SURFACE_DESTROYED (surface))
return;
@@ -2968,7 +2946,7 @@ gdk_x11_surface_set_input_region (GdkSurface *surface,
XRectangle *xrects = NULL;
_gdk_x11_region_get_xrectangles (input_region,
0, 0, impl->surface_scale,
0, 0, gdk_surface_get_scale_factor (surface),
&xrects, &n_rects);
XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface),
@@ -3845,15 +3823,17 @@ _gdk_x11_xwindow_get_shape (Display *xdisplay,
#define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
static void
wmspec_send_message (GdkDisplay *display,
wmspec_send_message (GdkDisplay *display,
GdkSurface *surface,
int root_x,
int root_y,
int action,
int button)
int root_x,
int root_y,
int action,
int button)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
XClientMessageEvent xclient;
int scale;
scale = gdk_surface_get_scale_factor (surface);
memset (&xclient, 0, sizeof (xclient));
xclient.type = ClientMessage;
@@ -3861,8 +3841,8 @@ wmspec_send_message (GdkDisplay *display,
xclient.message_type =
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_MOVERESIZE");
xclient.format = 32;
xclient.data.l[0] = root_x * impl->surface_scale;
xclient.data.l[1] = root_y * impl->surface_scale;
xclient.data.l[0] = root_x * scale;
xclient.data.l[1] = root_y * scale;
xclient.data.l[2] = action;
xclient.data.l[3] = button;
xclient.data.l[4] = 1; /* source indication */
@@ -4225,6 +4205,7 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display);
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
GdkX11Surface *impl;
int scale;
if (!mv_resize || !mv_resize->moveresize_surface)
{
@@ -4233,7 +4214,8 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
}
impl = GDK_X11_SURFACE (mv_resize->moveresize_surface);
scale = gdk_surface_get_scale_factor (GDK_SURFACE (impl));
if (mv_resize->moveresize_button != 0)
button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1);
@@ -4254,8 +4236,8 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
break;
update_pos (mv_resize,
event->xmotion.x_root / impl->surface_scale,
event->xmotion.y_root / impl->surface_scale);
event->xmotion.x_root / scale,
event->xmotion.y_root / scale);
/* This should never be triggered in normal cases, but in the
* case where the drag started without an implicit grab being
@@ -4266,22 +4248,22 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
if ((event->xmotion.state & button_mask) == 0)
{
check_maximize (mv_resize,
event->xmotion.x_root / impl->surface_scale,
event->xmotion.y_root / impl->surface_scale);
event->xmotion.x_root / scale,
event->xmotion.y_root / scale);
finish_drag (mv_resize);
}
break;
case ButtonRelease:
update_pos (mv_resize,
event->xbutton.x_root / impl->surface_scale,
event->xbutton.y_root / impl->surface_scale);
event->xbutton.x_root / scale,
event->xbutton.y_root / scale);
if (event->xbutton.button == mv_resize->moveresize_button)
{
check_maximize (mv_resize,
event->xmotion.x_root / impl->surface_scale,
event->xmotion.y_root / impl->surface_scale);
event->xmotion.x_root / scale,
event->xmotion.y_root / scale);
finish_drag (mv_resize);
}
break;
@@ -4295,24 +4277,24 @@ _gdk_x11_moveresize_handle_event (const XEvent *event)
switch (ev->evtype)
{
case XI_Motion:
update_pos (mv_resize, xev->root_x / impl->surface_scale, xev->root_y / impl->surface_scale);
update_pos (mv_resize, xev->root_x / scale, xev->root_y / scale);
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
if ((state & button_mask) == 0)
{
check_maximize (mv_resize,
xev->root_x / impl->surface_scale,
xev->root_y / impl->surface_scale);
xev->root_x / scale,
xev->root_y / scale);
finish_drag (mv_resize);
}
break;
case XI_ButtonRelease:
update_pos (mv_resize, xev->root_x / impl->surface_scale, xev->root_y / impl->surface_scale);
update_pos (mv_resize, xev->root_x / scale, xev->root_y / scale);
if (xev->detail == mv_resize->moveresize_button)
{
check_maximize (mv_resize,
xev->root_x / impl->surface_scale,
xev->root_y / impl->surface_scale);
xev->root_x / scale,
xev->root_y / scale);
finish_drag (mv_resize);
}
break;
@@ -4362,10 +4344,9 @@ create_moveresize_surface (MoveResizeData *mv_resize,
g_assert (mv_resize->moveresize_emulation_surface == NULL);
mv_resize->moveresize_emulation_surface =
_gdk_x11_display_create_surface (mv_resize->display,
GDK_SURFACE_TEMP,
NULL,
-100, -100, 1, 1);
gdk_x11_display_create_surface (mv_resize->display,
GDK_SURFACE_TEMP,
NULL);
gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE);
@@ -4660,17 +4641,6 @@ gdk_x11_surface_get_xid (GdkSurface *surface)
return GDK_X11_SURFACE (surface)->xid;
}
static int
gdk_x11_surface_get_scale_factor (GdkSurface *surface)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
if (GDK_SURFACE_DESTROYED (surface))
return 1;
return impl->surface_scale;
}
/**
* gdk_x11_surface_set_frame_sync_enabled:
* @surface: (type GdkX11Surface): a native #GdkSurface
@@ -4691,10 +4661,9 @@ gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface,
}
static void
gdk_x11_surface_set_opaque_region (GdkSurface *surface,
cairo_region_t *region)
gdk_x11_surface_set_opaque_region (GdkSurface *surface,
cairo_region_t *region)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
GdkDisplay *display;
int nitems;
gulong *data;
@@ -4704,7 +4673,9 @@ gdk_x11_surface_set_opaque_region (GdkSurface *surface,
if (region != NULL)
{
int i, nrects;
int i, nrects, scale;
scale = gdk_surface_get_scale_factor (surface);
nrects = cairo_region_num_rectangles (region);
nitems = nrects * 4;
@@ -4714,10 +4685,10 @@ gdk_x11_surface_set_opaque_region (GdkSurface *surface,
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (region, i, &rect);
data[i*4+0] = rect.x * impl->surface_scale;
data[i*4+1] = rect.y * impl->surface_scale;
data[i*4+2] = rect.width * impl->surface_scale;
data[i*4+3] = rect.height * impl->surface_scale;
data[i*4+0] = rect.x * scale;
data[i*4+1] = rect.y * scale;
data[i*4+2] = rect.width * scale;
data[i*4+3] = rect.height * scale;
}
}
else
@@ -4741,15 +4712,17 @@ static gboolean
gdk_x11_surface_show_window_menu (GdkSurface *surface,
GdkEvent *event)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
GdkDevice *device;
int device_id;
double x, y;
int x_root, y_root;
XClientMessageEvent xclient = { 0 };
GdkEventType event_type;
int scale;
GdkEventType event_type = gdk_event_get_event_type (event);
event_type = gdk_event_get_event_type (event);
scale = gdk_surface_get_scale_factor (surface);
switch ((guint) event_type)
{
@@ -4778,8 +4751,8 @@ gdk_x11_surface_show_window_menu (GdkSurface *surface,
xclient.window = GDK_SURFACE_XID (surface);
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_GTK_SHOW_WINDOW_MENU");
xclient.data.l[0] = device_id;
xclient.data.l[1] = x_root * impl->surface_scale;
xclient.data.l[2] = y_root * impl->surface_scale;
xclient.data.l[1] = x_root * scale;
xclient.data.l[2] = y_root * scale;
xclient.format = 32;
XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False,
@@ -4807,7 +4780,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
impl_class->drag_begin = _gdk_x11_surface_drag_begin;
impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
impl_class->set_opaque_region = gdk_x11_surface_set_opaque_region;
impl_class->create_gl_context = gdk_x11_surface_create_gl_context;
impl_class->request_layout = gdk_x11_surface_request_layout;

View File

@@ -57,8 +57,6 @@ struct _GdkX11Surface
guint frame_sync_enabled : 1;
guint tracking_damage: 1;
int surface_scale;
int shadow_left;
int shadow_right;
int shadow_top;

View File

@@ -437,7 +437,6 @@ static void gtk_window_css_changed (GtkWidget *widget,
GtkCssStyleChange *change);
static void _gtk_window_set_is_active (GtkWindow *window,
gboolean is_active);
static void gtk_window_present_toplevel (GtkWindow *window);
static void gtk_window_update_toplevel (GtkWindow *window,
GdkToplevelLayout *layout);
@@ -3800,8 +3799,6 @@ gtk_window_show (GtkWidget *widget)
gtk_widget_realize (widget);
gtk_window_present_toplevel (window);
gtk_widget_map (widget);
if (!priv->focus_widget)
@@ -3867,20 +3864,11 @@ gtk_window_map (GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *child = priv->child;
GTK_WIDGET_CLASS (gtk_window_parent_class)->map (widget);
if (child != NULL && gtk_widget_get_visible (child))
gtk_widget_map (child);
if (priv->title_box != NULL &&
gtk_widget_get_visible (priv->title_box) &&
gtk_widget_get_child_visible (priv->title_box))
gtk_widget_map (priv->title_box);
gtk_window_present_toplevel (window);
GTK_WIDGET_CLASS (gtk_window_parent_class)->map (widget);
if (priv->minimize_initially)
gdk_toplevel_minimize (GDK_TOPLEVEL (priv->surface));

View File

@@ -29,36 +29,36 @@ option('macos-backend',
option('media-ffmpeg',
type: 'feature',
value: 'auto',
value: 'disabled',
description : 'Build the ffmpeg media backend')
option('media-gstreamer',
type: 'feature',
value: 'auto',
value: 'enabled',
description : 'Build the gstreamer media backend')
# Print backends
option('print-cups',
type: 'feature',
value: 'auto',
value: 'enabled',
description : 'Build the cups print backend')
option('print-cloudprint',
type: 'feature',
value: 'auto',
value: 'disabled',
description : 'Build the cloudprint print backend')
# Optional features
option('vulkan',
type: 'feature',
value: 'auto',
value: 'disabled',
description : 'Enable support for the Vulkan graphics API')
option('xinerama',
type: 'feature',
value: 'auto',
value: 'enabled',
description : 'Enable support for the X11 Xinerama extension')
option('cloudproviders',
@@ -83,7 +83,7 @@ option('colord',
option('sassc',
type: 'feature',
value: 'auto',
value: 'disabled',
description: 'Rebuild themes using sassc')
# Documentation and introspection
@@ -100,7 +100,7 @@ option('man-pages',
option('introspection',
type: 'feature',
value: 'auto',
value: 'enabled',
yield: true,
description : 'Build introspection data (requires gobject-introspection)')

View File

@@ -127,17 +127,35 @@ g_io_module_query (void)
}
static void
gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self,
gint64 duration)
gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
{
GstPlayerMediaInfo *media_info;
if (gtk_media_stream_is_prepared (GTK_MEDIA_STREAM (self)))
return;
gtk_media_stream_prepared (GTK_MEDIA_STREAM (self),
TRUE,
TRUE,
TRUE,
duration);
media_info = gst_player_get_media_info (self->player);
if (media_info)
{
gtk_media_stream_prepared (GTK_MEDIA_STREAM (self),
gst_player_media_info_get_audio_streams (media_info) != NULL,
gst_player_media_info_get_video_streams (media_info) != NULL,
gst_player_media_info_is_seekable (media_info),
FROM_GST_TIME (gst_player_media_info_get_duration (media_info)));
}
else
{
/* Assuming everything exists is better for the user than pretending it doesn't exist.
* Better to be able to control non-existing audio than not be able to control existing audio.
*
* Only for seeking we can't do a thing, because with 0 duration we can't seek anywhere.
*/
gtk_media_stream_prepared (GTK_MEDIA_STREAM (self),
TRUE,
TRUE,
FALSE,
0);
}
}
static void
@@ -145,17 +163,17 @@ gtk_gst_media_file_position_updated_cb (GstPlayer *player,
GstClockTime time,
GtkGstMediaFile *self)
{
gtk_gst_media_file_ensure_prepared (self, 0);
gtk_gst_media_file_ensure_prepared (self);
gtk_media_stream_update (GTK_MEDIA_STREAM (self), FROM_GST_TIME (time));
}
static void
gtk_gst_media_file_duration_changed_cb (GstPlayer *player,
GstClockTime duration,
GtkGstMediaFile *self)
gtk_gst_media_file_media_info_updated_cb (GstPlayer *player,
GstClockTime duration,
GtkGstMediaFile *self)
{
gtk_gst_media_file_ensure_prepared (self, FROM_GST_TIME (duration));
gtk_gst_media_file_ensure_prepared (self);
}
static void
@@ -185,7 +203,7 @@ static void
gtk_gst_media_file_end_of_stream_cb (GstPlayer *player,
GtkGstMediaFile *self)
{
gtk_gst_media_file_ensure_prepared (self, 0);
gtk_gst_media_file_ensure_prepared (self);
if (gtk_media_stream_get_ended (GTK_MEDIA_STREAM (self)))
return;
@@ -205,7 +223,7 @@ gtk_gst_media_file_destroy_player (GtkGstMediaFile *self)
if (self->player == NULL)
return;
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_duration_changed_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_media_info_updated_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_position_updated_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_end_of_stream_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_seek_done_cb, self);
@@ -224,7 +242,7 @@ gtk_gst_media_file_create_player (GtkGstMediaFile *file)
self->player = gst_player_new (GST_PLAYER_VIDEO_RENDERER (g_object_ref (self->paintable)),
gst_player_g_main_context_signal_dispatcher_new (NULL));
g_signal_connect (self->player, "duration-changed", G_CALLBACK (gtk_gst_media_file_duration_changed_cb), self);
g_signal_connect (self->player, "media-info-updated", G_CALLBACK (gtk_gst_media_file_media_info_updated_cb), self);
g_signal_connect (self->player, "position-updated", G_CALLBACK (gtk_gst_media_file_position_updated_cb), self);
g_signal_connect (self->player, "end-of-stream", G_CALLBACK (gtk_gst_media_file_end_of_stream_cb), self);
g_signal_connect (self->player, "seek-done", G_CALLBACK (gtk_gst_media_file_seek_done_cb), self);