Commit Graph

5809 Commits

Author SHA1 Message Date
Matthias Clasen
a159635020 GdkScreen: Set reasonable limis for ::resolution
Otherwise, the spinbutton in the inspectors property editor
explodes in order to make room for MAXDOUBLE.
2014-07-04 02:01:53 -04:00
Jasper St. Pierre
f4b212abd4 wayland: Add some dumb support for the TARGETS selection
The way that GtkTextView et al pop up their context menu is to first
query to see if the clipboard has some text, and if so, enable the Paste
menu item. But since the Wayland backend hasn't had the greatest
selection and clipboard code, the callback for the clipboard got dropped
on the floor.

Add some simple code to respond to the TARGETS selection.

This makes right-clicking on a GtkTextView work fine.
2014-07-03 13:29:14 -04:00
Jasper St. Pierre
b5eddb0aa1 gdkwindow: Don't queue a redraw when calling gdk_window_raise with no effect
The resize grip code in GTK+ likes to call gdk_window_raise a lot. The
unfortunate side effect of gdk_window_raise is that it queues an
invalidation on the entire window, even if it's already the topmost
child.

Add a return value to gdk_window_raise_internal, and only queue the
invalidation if the raise had an effect.
2014-07-03 11:54:27 -04:00
Jasper St. Pierre
ec140a8f07 gdkwindow: Apply the 0x0 size bump to 1x1 before checking for the bail
Otherwise, a user that calls gdk_window_resize (window, 0, 0); over and
over won't properly fizzle out, and will queue a redraw. Clipped, but
still. These redraws can be chatty on some platforms like Wayland, and
there's no good reason to not avoid them.

This was the case for resize grips.
2014-07-03 11:51:54 -04:00
Matthias Clasen
1e205dcb05 win32: fix the build
A recent cleanup gone wrong,
https://bugzilla.gnome.org/show_bug.cgi?id=732454
2014-07-03 08:13:29 -04:00
Jasper St. Pierre
cd591a03e7 wayland: Make sure to notify the capability settings when we get capabilities
Otherwise, we won't notice when we get capabilities, and we'll show app
menus, etc.
2014-07-01 15:39:06 -04:00
Jasper St. Pierre
5740434137 gdkwindow: Fix an accidental code out-of-ordering
There's no semantics change, it just makes things clearer.
2014-06-29 20:27:45 -04:00
Jasper St. Pierre
8fb2bdb2fb gdkdevicemanager-xi2: Add debug output for key events 2014-06-29 19:10:42 -04:00
Jasper St. Pierre
de5cba4fc9 gdkdevicemanager-xi2: Fix debug outputs for button events
We had the arguments in the wrong order here.
2014-06-29 19:10:41 -04:00
Emilio Pozuelo Monfort
6de2c7fa0e wayland: don't change the cursor if there is no pointer
https://bugzilla.gnome.org/show_bug.cgi?id=732206
2014-06-28 00:12:20 -04:00
Colomban Wendling
de071768ae gdkwindow: Don't leak the surface in gdk_cairo_create() 2014-06-23 21:52:57 -04:00
Jasper St. Pierre
24b9e91f47 Revert "gtkwidget: Widgets are now always double-buffered"
This reverts commit b875572f2a.

Apps like Abiword, gnumeric and gnome-chess, and toolkits like
ClutterGTK were all using this for various purposes, and this made them
break. Bring back this feature for now.

It still won't work under Wayland.
2014-06-23 17:50:01 -04:00
Jasper St. Pierre
984e811c16 gdkwindow: Allow calling gdk_cairo_create outside of a "paint"
Apps had quite a bit of difficulty getting used to the new rules.
While we weren't expecting anything too deadly, it seemed that
gnumeric and Abiword both used gdk_cairo_create like this.
2014-06-23 17:50:00 -04:00
Jasper St. Pierre
e67e8ebb30 gdkwindow: Remove extra arguments from process_updates_recurse_helper
These can easily be calculated inside the function.
2014-06-23 16:44:09 -04:00
Jasper St. Pierre
70fe57703b gdkwindow: Don't do some extra work
We can do an early return in some specific cases before we need to
create and clip a cairo region.
2014-06-23 16:43:32 -04:00
Jasper St. Pierre
a9759c7756 gdkwindow: Remove an unused variable 2014-06-23 16:43:15 -04:00
Jasper St. Pierre
8eb092ea14 gdkwindow: Make the precondition of gdk_window_add_damage clearer 2014-06-23 15:00:01 -04:00
Jasper St. Pierre
06cfaea553 gdkwindow: Simplify check for damaging offscreen windows
If a window both has an impl and its impl_window is of type offscreen,
that must mean that it is the offscreen window, and the impl window is
itself. We can reduce the indirection here and make it more clear.
2014-06-23 15:00:01 -04:00
Jasper St. Pierre
b99dc9eede gdkwindow: Make gdk_window_add_damage more private 2014-06-23 15:00:01 -04:00
Matthias Clasen
d76785a993 win32: Drop remnants of def files
We no longer have .def files, so don't refer to them from the
win32 build machinery. Patch by Cilyan Olowen
2014-06-22 13:22:43 -04:00
Jasper St. Pierre
58715796d2 gdkwindow: Provide a default implementation of process_updates_recurse
As a quick code cleanup.
2014-06-22 10:20:50 -04:00
Jasper St. Pierre
a1fb252eba gdkwindow-broadway: Move the dirty flag setting to end_paint
This is where it belongs -- process_updates_recurse is the wrong place
for it.
2014-06-22 10:20:50 -04:00
Jasper St. Pierre
b59d2d1afa gdkwindow: Move a variable closer to where it's used
To make the code clearer.
2014-06-22 10:20:50 -04:00
Jasper St. Pierre
b2be9c0a9b gdkwindow: Remove an unused variable 2014-06-22 10:20:49 -04:00
Jasper St. Pierre
0dfd506b3c gdkwidow: Make queue_antiexpose optional 2014-06-21 18:45:41 -04:00
Jasper St. Pierre
8ae546857c gdkwindow-win32: Remove queue_antiexpose implementation
Since the Win32 code never actually called InvalidateRgn or used the
Win32 update area at all, that meant the only thing that could possibly
invalidate the window was the Win32 window manager as part of scrolling
or resizing, which would also send it a WM_PAINT message.

But the WM_PAINT handling called BeginPaint / EndPaint, which clears the
update area completely! We also draw out-of-band, not directly when
handling WM_PAINT, so there's no way that the update area inside the
Win32 WM would match our local one.

There is no possible way that this queue_antiexpose implementation could
do anything. Remove it.
2014-06-21 18:45:40 -04:00
Jasper St. Pierre
4d8cd2f7cf gdkevents-win32: Remove dead code 2014-06-21 18:45:40 -04:00
Jasper St. Pierre
c767d504c5 gdkwindow: Don't bother with a return parameter for queue_antiexpose
Standard refcounting works perfectly well. Don't give us the opportunity
for more memory leaks.
2014-06-21 18:45:39 -04:00
Jasper St. Pierre
dcef61ac44 gdkwindow-broadway: Squash memory leak
We don't need to hang on to the update_area.
2014-06-21 18:45:39 -04:00
Jasper St. Pierre
bb7bf07af6 gdkwindow-broadway: Make queue_antiexpose implementation private 2014-06-21 18:45:38 -04:00
Jasper St. Pierre
0bad7d8f5c gdkwindow-wayland: Attach new buffers and submit damage in end_paint
process_updates_recurse is simply the wrong place for it to be.
2014-06-21 18:45:38 -04:00
Jasper St. Pierre
afbadd6639 gdkwindow-wayland: Rename listener -> frame_listener
Don't pollute the static namespace here.
2014-06-21 18:45:38 -04:00
Jasper St. Pierre
9036ed0d67 gdkwindow: Correct a signature
We removed the parameter from callers and from the implementation, but
not from the signature up top. I didn't notice because the branch I was
working on removed the signature entirely.
2014-06-21 11:25:40 -04:00
Jasper St. Pierre
47d6677e92 gdkwindow: Remove an extra region copy
This code is only called with the current paint region as its argument.
Instead of having to copy it and do a no-op intersect against itself,
just use the current paint directly.
2014-06-21 11:00:24 -04:00
Jasper St. Pierre
7fefd211b8 gdkwindow: Clean up code
Introduce a temporary to make the code a bit more clear under these cases.
2014-06-21 10:17:23 -04:00
Jasper St. Pierre
e700305279 gdkwindow: Clean up formatting
Tabs to spaces, add some whitespace.
2014-06-21 10:17:06 -04:00
Jasper St. Pierre
ec5e913a9b gdkwindow: Add some extra documentation to gdk_cairo_create
Mention the need to wrap the function inside
gdk_window_begin_paint_region and gdk_window_end_paint.
2014-06-21 10:01:33 -04:00
Jasper St. Pierre
60d39e973a gdkwindow: Squash a leak in the subsurface case
cairo_surface_create_for_rectangle takes a ref on the parent surface,
so we need to drop ours.

Rename get_window_surface to ref_window_surface to make the code more
clear and to stop this error from happening again.
2014-06-20 20:48:21 -04:00
Jasper St. Pierre
d619a78aeb gdkwindow: Don't create a subsurface if we don't need to
In the case we have a native window, we don't need to crop it to a
non-native subrectangle, as abs_x / abs_y / width / height are all 0.
2014-06-20 20:46:49 -04:00
Jasper St. Pierre
be30e440c3 gdkwindow: Remove the ability to call begin_paint_region more than once
Previously, each begin_paint_region added to a stack of current paints,
and when end_paint was called, the paint was popped off of the stack and
the surface was composited into the parent paint surface.

However, the code was broken in the case of a backend like Wayland which
didn't keep track of nested calls and simply wiped and returned the
native impl backing surface every time.

Since this feature is flat out unused by GTK+ and we don't want to
really support tricksy things like these for other clients, just remove
the feature. If somebody does call begin_paint_region more than once,
warn and return without doing anything.
2014-06-20 20:41:55 -04:00
Jasper St. Pierre
d48adf9cee gdkwindow: Remove the internal cairo_surface used for out-of-band painting
Traditionally, the way painting was done in GTK+ was with the
"expose-event" handler, where you'd use GDK methods to do drawing on
your surface. In GTK+ 2.24, we added cairo support with gdk_cairo_create,
so you could paint your graphics with cairo.

Since then, we've added client-side windows, double buffering, the paint
clock, and various other enhancements, and the modern way to do drawing
is to connect to the "draw" signal on GtkWidget, which hands you a
cairo_t. To do double-buffering, the cairo_t we hand you is actually on
a secret surface, not the actual backing store of the window, and when
the draw handler completes we blit it into the main backing store
atomically.

The code to do this is with the APIs gdk_window_begin_paint_region,
which creates the temporary surface, and gdk_window_end_paint which
blits it back into the backing store. GTK+'s implementation of the
"draw" signal uses these APIs.

We've always sort-of supported people calling gdk_cairo_create
"outside" of a begin_paint / end_paint like old times, but then you're
not getting the benefit of double-buffering, and it's harder for GDK to
optimize.

Additionally, newer backends like Mir and Wayland can't actually support
this model, since they're based on double-buffering and swapping buffers
at various points in time. If we hand you a random cairo_t, we have no
idea when is a good time to swap.

Remove support for this.

This is technically a GDK API break: a warning is added in cases where
gdk_cairo_create is called outside of a paint cycle, and the returned
surface is a dummy that won't ever be composited back onto the main
surface. Testing with complex applications like Ardour didn't produce
any warnings.
2014-06-20 20:41:54 -04:00
Jasper St. Pierre
b875572f2a gtkwidget: Widgets are now always double-buffered
gtk_widget_set_double_buffered is now deprecated, and we don't support
non-double-buffered widgets. This means that under normal circumstances,
paints are never outside of a begin_paint / end_paint sequence, which
natively-double-buffered backends like Wayland can't possibly support.
2014-06-20 20:41:54 -04:00
Jasper St. Pierre
a85f7028d4 gdkwindow: Deprecate gdk_window_flush
The function does nothing.
2014-06-20 20:41:53 -04:00
Jasper St. Pierre
76922c169f wayland: Prevent stale paints and weird artifacts when using Weston
Weston releases buffers almost immediately after they're done, which
means that GTK+ doesn't use a temporary surface and instead paints
directly onto the SHM backing store that Weston will use.

Normally, after painting to the temporary surface, GTK+ *replaces*
the existing backing surface with CAIRO_OPERATOR_SOURCE. However,
if we immediately paint to the backing surface, it might have junk
from the last paint in it. So clear out the backing surface whenever
somebody calls begin_paint_region().

Maybe we should just always use the temporary surface like the X11
codepath, since that prevents us from having to do weird things like
this, but oh well.
2014-06-20 09:02:02 -04:00
Jasper St. Pierre
87e2a7d4b2 gdkwindow-wayland: Destroy the wl_surface too when hiding a window
wl_surfaces can't switch roles, so destroying the xdg_surface but not
the wl_surface means that we could get an error when trying to re-map
the surface.

We could fix this by not destroying the xdg resource and only do it at
finalization time, but it's just as easy to just create a new wl_surface.
2014-06-19 15:10:54 -04:00
Jasper St. Pierre
6926c6d9f8 gdkwindow-wayland: Destroy the xdg roles before the wl_surface
Since the xdg roles are a special case of the surface, some compositors
like Weston destroy them automatically when the wl_surface is destroyed.
Thus, we need to destroy these first.
2014-06-19 15:10:54 -04:00
Jasper St. Pierre
b35820fa3c gdkwindow-wayland: Add a forgotten ref 2014-06-19 14:56:17 -04:00
Jasper St. Pierre
0bbe2589f6 gdkwindow-wayland: Another slight rearrange 2014-06-19 14:56:17 -04:00
Jasper St. Pierre
ec7504fd57 gdkwindow-wayland: Pair a ref with its owner 2014-06-19 14:56:17 -04:00
Jasper St. Pierre
12fc77ad98 gdkwindow-wayland: Don't post CONFIGURE events for the same size
The Wayland compositor is completely allowed to send us configure
events for the same size, and this validly happens if we're changing
states. Fizzle these out.
2014-06-19 14:56:16 -04:00