Commit Graph

6103 Commits

Author SHA1 Message Date
Alexander Larsson
aaa335b9e8 gdk_cairo_draw_from_gl: Document that this changes the current context 2014-11-06 12:24:43 +01:00
Alexander Larsson
8c6395d8a1 GdkGLContextX11: Use passed in context, not get_current() 2014-11-06 12:24:43 +01:00
Alexander Larsson
10a44e8f7a Add gdk_gl_texture_quad() helper
Right now this just centralizes the glBegin/glEnd code, but
this will be replaced with buffer objects later.
2014-11-06 12:24:43 +01:00
Alexander Larsson
3c34ca3405 gdkgl: Don't constantly re-create the tmp framebuffer 2014-11-06 12:24:43 +01:00
Robert Ancell
053b65a21a mir: Handle pointer up/down events without a button mask set (i.e. touch events)
The Mir backend was checking for button mask changes to generate the appropriate
GDK event. When Mir generates a touch event it has no button mask. In this case
we'll just generate a primary button event.
2014-11-06 11:15:52 +13:00
Alexander Larsson
dd721acb84 GdkGLContextX11: Only set swap interval when it changed 2014-11-05 12:02:18 +01:00
Alexander Larsson
e4bf60224b GdkGL: Fix and clean up gdk_cairo_draw_from_gl()
This was unnecessarily creating a framebuffer in the texture case,
and it was not properly setting up a framebuffer with the texture
as source in the software fallback w/ texture source case.
2014-11-05 09:54:05 +01:00
Robert Ancell
c41231cc0f mir: Don't assert on unknown Mir events.
If we get a Mir event we don't understand generate a warning instead of an assert.
2014-11-05 15:50:55 +13:00
Matthias Clasen
113e1d1dc0 Make window scale changes work again
Commit afd9709aff made us keep impl window
cairo surfaces around across changes of window scale. But the
window scale setter forgot to update the size and scale of the
surface. The effect of this was that toggling the window scale
from 1 to 2 in the inspector was not causing the window to draw
at twice the size, although the X window was made twice as big,
and input was scaled too. Fix this by updating the surface when
the window scale changes.
2014-11-03 22:35:11 -05:00
Alexander Larsson
6fbc439fd7 GdkGLContext: Add display property
We need to use this in the code path where we make the context
non-current during destroy, because at that point the window
could be destroyed and gdk_window_get_display() would return
NULL.
2014-11-03 13:20:55 +01:00
Matthias Clasen
1a3bdefb00 Fix an ordering issue in event destruction
gdk_event_get_display accesses event->any.window, so don't
free that window first thing.
2014-11-01 14:44:03 -04:00
Alexander Larsson
869f300f0a gdk_x11_display_make_gl_context_current: move some code
This moves the code related to the frame sync code into
the is_attached check, which means we don't have to ever
run this when making non-window-paint contexts current.

This is a minior speed thing, but the main advantage
is that it makes making a non-paint context current
threadsafe.
2014-10-30 21:04:29 +01:00
Alexander Larsson
0eb2fb01fd Add GdkGLContext::profile 2014-10-30 12:43:03 +01:00
Alexander Larsson
398697eb2f Clarify docs for gdk_cairo_draw_from_gl 2014-10-30 12:43:03 +01:00
Alexander Larsson
f0ae8da993 Remove GdkGLContext::visual
This is not really needed. The gl context is totally tied to the
window it is created from by virtue of sharing the context with the
paint context of that window and that context always has the visual
of the window (which we already can get).

Also, all user visible contexts are essentially offscreen contexts, so
a visual doesn't make sense for them. They only use FBOs which have
whatever format that the users sets up.
2014-10-30 12:43:03 +01:00
Alexander Larsson
5f14630b76 GdkWindow: destroy paint gl context on destroy 2014-10-30 12:43:03 +01:00
Alexander Larsson
dbbab0791d GdkGLContext: Track shared context
This allows us to read it back, but primarily it ensures
the shared context wrapper stays alive as long as the context.
2014-10-30 12:43:03 +01:00
Alexander Larsson
fb50015519 GdkGLContext: Change the way we track the current context
To properly support multithreaded use we use a global GPrivate
to track the current context. Since we also don't need to track
the current context on the display we move gdk_display_destroy_gl_context
to GdkGLContext::discard.
2014-10-30 12:43:03 +01:00
Alexander Larsson
afd9709aff GdkWindowX11: Keep the impl window cairo surface around until destroy
We used to have a weak ref to the cairo surface and it was keep
alive by the references in the normal windows, but that reference
was removed by d48adf9cee, causing
us to constantly create and destroy the surface.

https://bugzilla.gnome.org/show_bug.cgi?id=738648
2014-10-30 10:32:47 +01:00
Carlos Garnacho
b0313c7bcf wayland: Emit GDK_OWNER_CHANGE events around wl_data_offer changes
This way the upper GtkClipboard code emits correctly ::owner-change when
receiving these events.
2014-10-29 18:33:48 +01:00
Alexander Larsson
c7451bbf3b GdkX11GLContext: Fix leak 2014-10-29 13:52:04 +01:00
Alexander Larsson
8c7623de84 Cache default gdk visuals in the GDK_VISUALS property on the root window
This means we don't have to try to initialize opengl in every gtk
instance that is stated. It will only happen for the first one.

https://bugzilla.gnome.org/show_bug.cgi?id=738670
2014-10-29 13:35:17 +01:00
Alexander Larsson
dae447728d X11: Pick better system and rgba visuals for GL
We want to create windows with the default visuals such that we then
have the right visual for GLX when we want to create the paint GL
context for the window.

For instance, (in bug 738670) the default rgba visual we picked for the
NVidia driver had an alpha size of 0 which gave us a BadMatch when later
trying to initialize a gl context on it with a alpha FBConfig.

Instead of just picking what the Xserver likes for the default, and just
picking the first rgba visual we now actually call into GLX to pick
an appropriate visual.
2014-10-29 13:35:17 +01:00
Alexander Larsson
d5cd05a0f4 GdkGLContextX11: Don't free NULL visual info 2014-10-29 11:26:00 +01:00
Matthias Clasen
3f1dc87188 Plug another memory leak
Also found by valgrind.
2014-10-28 16:07:57 -04:00
Matthias Clasen
c8d4eefa71 Plug some memory leaks in GL support
valgrind pointed these out.
2014-10-28 16:07:57 -04:00
Alexander Larsson
0814cd9f8b GdkGlContextWayland: Don't require specific bit depths
This just means we may fail to get a gl context, we just require
*some* color depth.
2014-10-28 18:30:09 +01:00
Alexander Larsson
3406bbd128 Pick the first rgba visual, not the last
The visuals are typically sorted by some sort of "most useful first"
order. And picking the last one is likely to give us the weirdest
matching glx visual.
2014-10-28 18:30:09 +01:00
Alexander Larsson
8d6d6dcca3 GdkGLContextX11: Ensure we get the fbconfig with the exact same visual
We really want a gl context with exactly the same visual, or we will
get a badmatch later, which hits us on nvidia as per:

https://bugzilla.gnome.org/show_bug.cgi?id=738670
2014-10-28 18:30:09 +01:00
Matthias Clasen
b673490a1b Document Wayland opacity handling 2014-10-28 10:48:49 -04:00
Jasper St. Pierre
c40ba85ace wayland: Don't use the default display
Pass a display in so that multi-display technology works.
2014-10-27 22:29:41 -07:00
Jasper St. Pierre
bbe9ef20da gdkevents: Use the correct display to copy event data 2014-10-27 22:29:41 -07:00
Jasper St. Pierre
887b7356c3 gdkdisplay: Provide a default event_data_copy / event_data_free
Every single implementation but Quartz is a no-op for this, so just
provide it once rather than in every backend.
2014-10-27 22:13:23 -07:00
Matthias Clasen
abe7187cfb Add another multi-device invariant
The device and window passed to gdk_device_grab() must be
on the same display, or things are unlikely to work.
Document and assert this.
2014-10-28 00:54:39 -04:00
Matthias Clasen
4c69dabb6e Don't return GDK_GRAB_SUCCESS on failure
That seems ... counterproductive.
2014-10-28 00:51:32 -04:00
Matthias Clasen
d1dcac85f3 Mention the 'same display' requirement in the docs too 2014-10-28 00:44:33 -04:00
Matthias Clasen
eedff39413 Deprecate gdk_cursor_new()
Too easy to introduce an unintended assumption about the display
being the default this way.
2014-10-28 00:38:59 -04:00
Jasper St. Pierre
52e3b88382 gdkwindow: Specify some invariants for cursors
Cursors should not be on a different display than their window /
device, as that would break Wayland.
2014-10-27 21:22:31 -07:00
Jasper St. Pierre
0f79cb3d11 x11: Scale the frame extents as well 2014-10-27 16:54:33 -07:00
Alexander Larsson
f7b1ba0943 opengl: Use GL_TEXTURE_2D rather than GL_TEXTURE_RECTANGLE_ARB when possible
This is more standard, and most driver support non-power-of-2 TEXTURE_2D
these days. We fall back for ancient drivers.
2014-10-27 21:17:08 +01:00
Alexander Larsson
08d44648ea opengl: Use proper blend function for premultiplied alpha 2014-10-27 21:17:08 +01:00
Alexander Larsson
72a6459d73 gdkglcontext: Track whether to use GL_TEXTURE_2D or GL_TEXTURE_RECTANGL_ARB 2014-10-27 21:17:08 +01:00
Alexander Larsson
3013997e23 Rename gdk_gl_context_flush_buffer to gdk_gl_context_end_frame
This makes a lot more sense.
2014-10-27 16:33:37 +01:00
Matthias Clasen
3a2bf9d878 quartz: Move the FullscreenSavedGeometry definition earlier
Move the FullscreenSavedGeometry before the first (conditional)
use, to fix the build on OS X 10.6.

https://bugzilla.gnome.org/show_bug.cgi?id=737561
2014-10-27 06:49:46 -04:00
Marcus Karlsson
a703437796 quartz: fix build on 10.6 and below
It is not possible to successfully build GTK+ on OS X 10.6 and below
since NSFullScreenWindowMask is only available starting with 10.7. Add
ifdef guards around setStyleMask: in order to allow it to build on
earlier OS X releases.

https://bugzilla.gnome.org/show_bug.cgi?id=737561
2014-10-27 06:46:12 -04:00
Matthias Clasen
e75310a445 Fix an out-of-bounds access in MyEnhancedXkbTranslateKeyCode
Commits 314b6abbe8 and eb9223c008 were ignoring
the fact that the code where found is set to 1 was modifying
col - which was an ok thing to do when that part of the code
was still breaking out of the loop, but it is no longer doing
that (since 2003 !). Fix things up by storing the final col
value in a separate variable and using that after the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=738886
2014-10-26 21:48:59 -04:00
Matthias Clasen
f733fa88f5 Broadway: Remove display assumptions
In various places, the broadway backend was just using
the default display and assumed that it is the broadway
display. That may not be the case in a multi-backend world,
so instead iterate over all displays and use the first
broadway display - still not perfect, but enough to survive
for now.
2014-10-25 10:32:53 -04:00
Matthias Clasen
32326f826f X11: Don't assume all displays are X11 displays
When iterating over the list of displays gotten from the
display manager, we have to check if what we got is actually
an X11 display.
2014-10-24 19:05:09 -04:00
Rico Tzschichholz
0144861dca gdkglcontext-x11: Use epoxy/glx.h rather then GL/glx.h 2014-10-23 14:29:45 +02:00
Matthias Clasen
318c97c959 Fix mispositioned window menu in hi-dpi
We always want to send the position in device pixels,
so apply the window scale before sending them out.

https://bugzilla.gnome.org/show_bug.cgi?id=738955
2014-10-22 22:49:31 -04:00
Chun-wei Fan
35486e7990 gdk/broadway/toarray.pl: Fix Code Generation for MSVC
The current implementation of this script generate headers with \x-escaped
strings that can become too long (> 65535 characters) for Visual Studio
to consume, hence the build of broadwayd would break on Visual Studio.

This changes the script to instead format the string as an array of hex
characters, not unlike what GResource does, so that builds can continue as
normal on Visual Studio builds as well.

https://bugzilla.gnome.org/show_bug.cgi?id=739001
2014-10-23 09:12:22 +08:00
Robert Ancell
0f26b26f1d Gdk: add an experimental backend for mir
This is disabled by default.  Enable with --enable-mir-backend.

This backend is a combined work of Robert Ancell and Ryan Lortie.
2014-10-22 11:17:15 -05:00
Matthias Clasen
6440263ef3 GL: Follow naming conventions
All the GDK type defines are GDK_TYPE_..., so follow this
pattern for the GLContext subclasses as well.
2014-10-21 23:48:12 -04:00
Ryan Lortie
6d7f5d4431 wayland: don't init if XDG_RUNTIME_DIR missing
wayland doesn't strictly follow the XDG_RUNTIME_DIR spec by falling back
to another directory in case the runtime dir is not properly set.

When this variable is unset, wayland will log an error to us, which we
treat as fatal, aborting the entire program.

Skip ourselves all the trouble and don't try to bring up the wayland
backend when we know it will fail in this way.

https://bugzilla.gnome.org/show_bug.cgi?id=738873
2014-10-21 08:12:12 -04:00
Adel Gadllah
45288ec40c gdkglcontext-x11: Fix pixmap creation
Always use NPOT textures

https://bugzilla.gnome.org/show_bug.cgi?id=738670
2014-10-21 13:58:28 +02:00
Alexander Larsson
82753bc72b x11 glcontext: Always use RGBA texture format, as we use alphas 2014-10-21 13:51:24 +02:00
Bastien Nocera
4af0379aae wayland: Don't try to create a subsurface again
We already did that inside gdk_wayland_window_create_surface() that's
called 2 lines above.

https://bugzilla.gnome.org/show_bug.cgi?id=738912
2014-10-21 12:18:01 +02:00
Alexander Larsson
142368f095 X11: Fix crash in gdk_x11_gl_context_texture_from_surface
We need to look at the impl_window for the gl rendering, not
the subwindow we're rendering into.
2014-10-16 13:00:45 +02:00
Benjamin Otte
672a67d0af gdk: Add GDK_DEBUG=nogl
This is mostly useful for fallback testing.

I suppose if people want finer grained GL ability testing, they can use
Mesa environment variables to tune things.
2014-10-16 03:33:15 +02:00
Matthias Clasen
f99cbdf49f Plug a memory leak
We were leaking cairo regions every time we draw.
2014-10-14 22:46:26 -04:00
Matthias Clasen
7de9995f7d Pedantic formatting fix 2014-10-13 10:43:32 -04:00
Matthias Clasen
98904b8910 Nitpicky documentation changes 2014-10-13 10:43:32 -04:00
Matthias Clasen
417e0894e7 Correct another Since tag 2014-10-13 10:43:32 -04:00
Matthias Clasen
706a7064a0 Trivial formatting fixes 2014-10-13 10:43:32 -04:00
Matthias Clasen
a74c5a1f39 Correct copyright year 2014-10-13 10:43:32 -04:00
Matthias Clasen
7a80c3b004 Correct Since tags 2014-10-13 10:43:32 -04:00
Alexander Larsson
fdeb4f8c16 gl: Make gdk_gl_context_make_current() return void
Its not really reasonable to handle failures to make_current, it
basically only happens if you pass invalid arguments to it, and
thats not something we trap on similar things on the X drawing side.

If GL is not supported that should be handled by the context creation
failing, and anything going wrong after that is essentially a critical
(or an async X error).
2014-10-13 10:43:32 -04:00
Alexander Larsson
017775f288 X11 GdkGLContext: Remove spurious XSync
This XSync doesn't seem to be necessary. Remove it until otherwise
proven.
2014-10-13 10:43:32 -04:00
Alexander Larsson
3d43a9b084 Fix warning 2014-10-13 10:43:32 -04:00
Alexander Larsson
236d08c3c5 gl: Make all user GdkGLContexts not attached to any window
We make user facing gl contexts not attached to a surface if possible,
or attached to dummy surfaces. This means nothing can accidentally
read/write to the toplevel back buffer.
2014-10-13 10:43:31 -04:00
Alexander Larsson
7eae4985e8 wayland: Add OpenGL support
This uses EGL to implement GdkGLContext for wayland.
2014-10-13 10:43:31 -04:00
Alexander Larsson
6717242d26 wayland: Set GdkVisual::bits_per_rgb to 8
This was 0 before.
2014-10-13 10:43:31 -04:00
Alexander Larsson
87970ea2d0 Add GDK_ALWAYS_USE_GL debug hack
If this is set we always use GL to render each window, even
if there are no GL widgets in the window.
2014-10-13 10:43:31 -04:00
Alexander Larsson
038aac6275 gdk: Add support for OpenGL
This adds the new type GdkGLContext that wraps an OpenGL context for a
particular native window. It also adds support for the gdk paint
machinery to use OpenGL to draw everything. As soon as anyone creates
a GL context for a native window we create a "paint context" for that
GdkWindow and switch to using GL for painting it.

This commit contains only an implementation for X11 (using GLX).

The way painting works is that all client gl contexts draw into
offscreen buffers rather than directly to the back buffer, and the
way something gets onto the window is by using gdk_cairo_draw_from_gl()
to draw part of that buffer onto the draw cairo context.

As a fallback (if we're doing redirected drawing or some effect like a
cairo_push_group()) we read back the gl buffer into memory and composite
using cairo. This means that GL rendering works in all cases, including
rendering to a PDF. However, this is not particularly fast.

In the *typical* case, where we're drawing directly to the window in
the regular paint loop we hit the fast path. The fast path uses opengl
to draw the buffer to the window back buffer, either by blitting or
texturing. Then we track the region that was drawn, and when the draw
ends we paint the normal cairo surface to the window (using
texture-from-pixmap in the X11 case, or texture from cairo image
otherwise) in the regions where there is no gl painted.

There are some complexities wrt layering of gl and cairo areas though:
* We track via gdk_window_mark_paint_from_clip() whenever gtk is
  painting over a region we previously rendered with opengl
  (flushed_region). This area (needs_blend_region) is blended
  rather than copied at the end of the frame.
* If we're drawing a gl texture with alpha we first copy the current
  cairo_surface inside the target region to the back buffer before
  we blend over it.

These two operations allow us full stacking of transparent gl and cairo
regions.
2014-10-13 10:43:31 -04:00
Alexander Larsson
d0147a6f2c Add gdk_window_mark_paint_from_clip and call from widget drawing
This is a new function that gets called every time we're drawing
some area in the Gtk paint machinery. It is a no-op right now, but
it will be required later to keep track of what areas which
we previously rendered with GL was overwritten with cairo contents.
2014-10-13 10:43:31 -04:00
Alexander Larsson
a8f11835c5 Change the way the update area is tracked during paint
First of all we track the current update area during an
update in window->active_update_area. This will be used later
in end_paint to know the damaged area.

Secondly we keep track of old update areas for the last 2
frames. This will later allow us to reuse old framebuffer
contents in double or tripple buffer setups, only painting
what has changed since then.
2014-10-13 10:43:31 -04:00
Alexander Larsson
ceeed1c48d Add internal gdk_cairo_region_from_clip helper
This extract the current cairo clip region if possible and
returns it as a cairo_region_T. It will be needed by later code.
2014-10-13 10:43:31 -04:00
Jasper St. Pierre
ea21c4563b gdkwindow-x11: Fix graphical regression from 5e325c4
Before 5e325c4, the default BitGravity was NorthWestGravity.
When static gravities were removed in 5e325c4, the BitGravity regressed
to the X11 default, Forget. Forget causes giant graphical glitches and
black flashes when resizing, especially in some environments that aren't
synchronized to a paint clock yet, like XWayland.

I'm assuming that the author assumed that the default of BitGravity was
NorthWestGravity, which is the default of WinGravity. Just go ahead and
fix this regression to make resizing look smooth again.
2014-10-13 02:19:36 -07:00
Benjamin Otte
508d31fe70 gdk: Deprecate compositing support
We might want to remove support for it completely and always return
FALSE.
2014-10-12 04:54:35 +02:00
Carlos Garnacho
69d9746708 wayland: write wl_data_offer data asynchronously
Currently writing wl_data_offer data into the fd is 1) synchronous, which
is noticeable when transferring large amounts of data, and 2) buggy, write()
error checking is done on the accumulator, breaking both the written data
accounting and error checking itself.

Fix both by making writes asynchonous through GOutputStream, the operation
is spun off and either finished, or cancelled if new data is stored in the
selection while the transfer is active.
2014-10-10 20:58:55 +02:00
Vasiliy Nuzha
ba6522d3f2 Fix monitors enumeration bug
Fix monitors enumeration bug. By default used MONITORINFOEXW (UTF-16 Build) with wrong structure size
2014-10-06 22:48:08 +00:00
Jasper St. Pierre
1914e65591 gdkwindow: Fix small typo 2014-10-06 13:36:59 -07:00
Benjamin Otte
f3bd78a3cf gdk: Fix gdk_cairo_create() without begin_paint()
We were translating the clip region twice in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=737825
2014-10-06 22:24:28 +02:00
Kalev Lember
112e74ed64 gdk: Allow calling gdk_cairo_surface_create_from_pixbuf with scale 0
The documentation explicitly states that 0 is an allowed value for using
the same scale as the window. This 0 value is also explicitly checked
down in the call chain and handled.
2014-10-06 14:39:22 +02:00
Benjamin Otte
5e4672092a gdk: Deprecate static gravities
... and remove all implementations. The API allows to not work "if the
server doesn't support it. So from now on, no server does!
2014-10-06 02:38:40 +02:00
Matthias Clasen
919bdff7ac GdkDevice: Avoid unnecessary critical
There is no need for a critical warning just because somebody
asked for a property that is not meaningful for the device.
Just document it as not useful for keyboard devices.
2014-10-05 19:43:06 -04:00
Benjamin Otte
cff37ce26e x11: Remove overeager check
window->parent must exist, it's dereferenced a few lines below.

Avoids clang complaints.
2014-10-05 11:25:06 +02:00
Benjamin Otte
66be6a018c gdk: Remove overeager checks
Parent is guaranteed to not be NULL. It can only ever be NULL for root
windows and root windows cannot be created with gdk_window_new() and
gdk_window_ensure_native() will exit early because they already are
native.

Also, both functions would crash a few lines below where parent gets
dereferenced.
2014-10-05 11:25:05 +02:00
Benjamin Otte
3526f2081b x11: Remove unneeded and wrong return_if_fail()
It triggers coverity warnings.
2014-10-05 11:25:05 +02:00
Marek Kasik
8b5d30d439 Remove redundant checks for NULL
Remove checks for NULL before g_free() and g_clear_object().
Merge check for NULL, freeing of pointer and its setting
to NULL by g_clear_pointer().

https://bugzilla.gnome.org/show_bug.cgi?id=733157
2014-10-02 19:06:03 +02:00
Matthias Clasen
52c913156f Don't emit a useless warning
The warning may have had some value at some point, but if
people uninstall large icons just to make the warning go
away, it does more harm than good. So just remove it.
2014-10-01 13:17:14 -04:00
Matthias Clasen
61b636b8a4 Add 3.16 deprecation macros too 2014-09-30 00:03:25 -04:00
Matthias Clasen
c2330e7fd1 Add 3.16 version macros 2014-09-29 23:56:20 -04:00
Matthias Clasen
9b5e70c9c2 Broadway: Improve formatting of an error message
https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:21 -04:00
Pierre-Yves Luyten
dce69904d8 gdk_rgba_parse : do not segfault on null string 2014-09-28 21:18:10 +02:00
Matthias Clasen
6604f00236 Implement titlebar action settings for Wayland
https://bugzilla.gnome.org/show_bug.cgi?id=729782
2014-09-25 14:54:49 -04:00
Matthias Clasen
69a44ee9ef Implement titlebar action settings for X11
https://bugzilla.gnome.org/show_bug.cgi?id=729782
2014-09-25 14:54:49 -04:00
Matthias Clasen
4f76f18b9f Improve workarea documentation
Worth mentioning that workarea may not exist, and that we
return the full monitor geometry in that case.
2014-09-24 20:34:16 -04:00
Matthias Clasen
46ff5ef6ce x11: Neuter workarea in fullscreen scenarios
If we have a fullscreen window that covers a monitor, desktop
chrome is not relevant for placing of menus and other popups.
Therefore, return the full monitor geometry instead of the
workarea in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=737251
2014-09-24 20:31:11 -04:00
Jehan
c87c5cd0ba win32: provide an implementation for gdk_test_simulate_key().
https://bugzilla.gnome.org/show_bug.cgi?id=734879
2014-09-22 21:22:33 -04:00
Carlos Garnacho
f96437317b gdkwindow: check grab window and children on get_pointer_window()
If !owner_events, the pointer window has been usually set to NULL if
the pointer fell outside the grabbing widget, but it was not being
checked that the pointer_window is actually a child of the grab
window, in which case it should be obtained as if ungrabbed.

https://bugzilla.gnome.org/show_bug.cgi?id=735749
2014-09-22 20:30:12 -04:00
Руслан Ижбулатов
45ab4ae09b build: Set no_undefined in Makefile.decl
This simplifies the code and - more importantly - fixes the cases like
in testsuite/reftests where the no_undefined definition was missing.

https://bugzilla.gnome.org/show_bug.cgi?id=736382
2014-09-15 16:35:40 +02:00
Руслан Ижбулатов
a8915b89d7 Initialize impl_window for foreign W32 windows
https://bugzilla.gnome.org/show_bug.cgi?id=736269
2014-09-08 15:50:32 +00:00
Matthias Clasen
e1aca0e8c6 Link broadway backend against librt
This is needed for shm_open, according to its man page.

https://bugzilla.gnome.org//show_bug.cgi?id=698031
2014-09-07 21:30:51 -04:00
Matthias Clasen
719e2157f2 Small doc improvement 2014-09-07 17:14:37 -04:00
Matthias Clasen
d52d813c7d GdkFrameClockIdle: Add a missing declaration 2014-09-05 20:44:22 -04:00
Matthias Clasen
52578945bd Wayland: Fix various compiler warnings
Mostly missing declarations, missing statics and unused functions.
2014-09-05 20:41:06 -04:00
Matthias Clasen
24b8499833 Broadway: Fix various compiler warnings
Mostly missing declarations and unused functions.
2014-09-05 19:39:05 -04:00
Jasper St. Pierre
4764ba4b0e wayland: Don't leak the tmp_keymap
This is a static variable, so setting it every time will leak the
previous one.
2014-09-05 15:06:19 -07:00
Jasper St. Pierre
b692d779b2 wayland: Correctly find the keyboard for the keymap
The list of devices was being scanned over incorrectly, causing us to
never actually fetch the keymap from the keyboard, as the keyboard was
the second device in the list, not the first.

This causes us to create a new temporary keymap every time, which is
quite expensive, because it involves parsing the entire XKB
file. Scanning the list correctly will cause us to use the XKB rules
file that was passed to us.
2014-09-05 15:06:19 -07:00
Matthias Clasen
b156d5bfee Make a warning more informative
Since we know what size was too large here, why not say it.
2014-09-05 13:43:17 -04:00
Alexander Larsson
53dab9240d GdkWindow: Remove unused fields
clip_region_with_children and layered_region is not used any more,
remove them.
2014-09-05 09:44:28 +02:00
Jasper St. Pierre
0acad84366 gdkcairo: Add a missing flush
Noticed by ickle on IRC. We need to flush here to make sure that the
image data we fetch is up to date.
2014-09-02 11:26:55 -07:00
Alexander Larsson
6243c7122c gdkwindow: Fix update area calculations for native subwindows
When recursing the update area down into native subwindows we forgot
to apply the native window position. This caused us to repaint the
wrong thing in certain cases. I noticed this when playing with the
wip/gdk-gl branch, because it was triggering unnecessary repaints
of the (native window) gl widgets.
2014-09-02 17:14:59 +02:00
Carlos Garnacho
7fbac57712 wayland: Unset window_impl->commit_pending when hiding the surface
A surface may be hidden when a frame is already scheduled, which may cause
crashes on on_frame_clock_after_paint() when calling commit() on a NULL
surface. To fix this, ensure commit_pending is also set to FALSE when the
surface is gone.

https://bugzilla.gnome.org/show_bug.cgi?id=735226
2014-09-01 22:44:08 +02:00
Carlos Garnacho
d5dae5b5df wayland: Store and use the current grab cursor, if any
Only static cursors are supported in gdk_device_grab() so far. Obey the
cursor that gdk_device_grab() specifies, which may be different to
the pointer window one. As soon as the grab is gone, the pointer window
cursor will be restored as usual.

https://bugzilla.gnome.org/show_bug.cgi?id=735831
2014-09-01 20:46:29 +02:00
Carlos Garnacho
2c71b8f599 wayland: Keep the last cursor on leave, try to restore it on enter
On DnD, pointer_handle_leave may be triggered without the pointer actually
leaving the window, and pointer_handle_enter() happening after intra-window
DnD won't actually manage to update the cursor (it does nothing directly,
and to the upper layers the cursor is still the same and consistent, so no
attempt will happen).

To fix this, keep the pointer cursor on leave, and ensure it is updated
on enter. The pointer cursor will be updated to any current new one through
the enter/motion events generated if it needs be.

https://bugzilla.gnome.org/show_bug.cgi?id=735831
2014-09-01 20:46:29 +02:00
Carlos Garnacho
a0abdbbdd6 wayland: Reference pixmap-based cursors' surface before handing the wl_buffer
cairo_surface_destroy() is called after the buffer is released, for every
wl_buffer. Windows usually reference their cairo surface before rendering,
so that extra reference is consumed after the buffer is released, so do
the same with cursor surfaces and add an extra reference whenever a cursor
surface change is about to be scheduled.

Otherwise, the GdkWaylandCursor is left with an invalid cairo_surface_t,
which causes crashes the next time it is used.

https://bugzilla.gnome.org/show_bug.cgi?id=735830
2014-09-01 20:46:29 +02:00
Carlos Garnacho
8504890867 wayland: Add private API to retrieve the drag window for a drag context
On wayland the DnD surface must be created early when starting the drag
operation, so offer API for GTK+ to get the GdkWindow used as a DnD
surface on the drag operation.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:54 +02:00
Carlos Garnacho
6ba7d347c7 wayland: Return properly type hints from GdkWindows
This was hardcoded to GDK_WINDOW_TYPE_HINT_NORMAL, even though wayland
windows store the type hint themselves.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:54 +02:00
Carlos Garnacho
867302e2c7 wayland: Don't set an xdg surface to DnD windows
https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
7b85a3417a wayland: Implement drag sources
The wl_data_source is retrieved from the selection object for the DnD
selection, and used to initiate a drag. When the drag is finished, a
button release or touch end event is synthesized to finish the DnD
operation after the compositor grab is gone.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
9b0b88d16b wayland: Implement the dropping part of DnD
All destination-side events are emitted, and updates to the drop context
are notified through the currently handled wl_data_offer.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
f48b3cce02 wayland: Replace clipboard implementation
The wayland specific clipboard functions have been replaced by something
more similar to the hooking the win32 backend does, which allows for just
using the default GtkClipboard code in GTK+. As a consequence, the
wayland-specific GtkClipboard implementation is now gone.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
7744799072 wayland: Implement drag/source side of selections
This has been made to work similarly to X11, requests for the data device
contents are notified through GDK_SELECTION_REQUEST events, the data stored
in the GDK_SELECTION property as a reaction to that event is then stored
into the wayland selection implementation, and written to the fd when
requested/available.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
3b953041a9 wayland: Implement drop/destination side of selections
This implementation makes the destination side of selections work
similarly to X11's, gdk_selection_convert() triggers data fetching,
which is notified through GDK_SELECTION_NOTIFY events on arrival,
the buffered data is then available through gdk_selection_property_get().

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
32bf03c053 wayland: implement text_property_to_utf8_list()
Of some sort, this is enough to get text transfers on wayland, anything but
utf8 as plain/text should be pretty rare.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
5fcf2de617 gdk: Remove check for source window
This is backend dependent, on wayland there is no such source window,
not even on local DnD situations.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
9c16d8bb50 gdk: Add GDK_DRAG_PROTO_WAYLAND
To be used on the wayland windowing backend as the DnD protocol.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Matthias Clasen
0fed16d1b0 Trivial formatting fix 2014-08-30 00:53:21 -04:00
Jesse van den Kieboom
b107c9f02c quartz: Get default font size from user font
https://bugzilla.gnome.org/show_bug.cgi?id=735321
2014-08-28 20:02:20 +02:00
Jesse van den Kieboom
b57bef989a quartz-dnd: make sure to set source window
https://bugzilla.gnome.org/show_bug.cgi?id=658722
2014-08-27 20:57:17 +02:00
Carlos Garnacho
d34f2526c4 wayland: Ensure the parent is committed after repositioning subsurfaces
Subsurface position is deemed part of the state of the parent surface, so
ensure wl_surface_commit() happens on the parent surface if none is
scheduled, so the repositioning takes place.
2014-08-27 17:45:16 +02:00
Emmanuele Bassi
79c3ff3c4e threads: Do not release the GDK lock if it hasn't been acquired yet
Since GLib ≥ 2.41, attempting to release an unlocked mutex will abort(),
as it happens on most systems already.

Given the lack of proper documentation on how to use GDK with threads,
there is code in the wild that does:

    gdk_threads_init ();
    gdk_init ();

    ...

    gtk_main ();

instead of the idiomatically correct:

    gdk_threads_init ();
    gdk_threads_enter ();

    gtk_init ();

    ...

    gtk_main ();

    ...

    gdk_threads_leave ();

Which means that gtk_main() will try to release the GDK lock, and thus
trigger an error from GLib.

we cannot really fix all the wrong code everywhere, and since it does
not cost us anything, we can work around the issue inside GDK itself, by
trying to acquire the GDK lock inside gdk_threads_leave() with
trylock().

https://bugzilla.gnome.org/show_bug.cgi?id=735428
2014-08-26 20:07:33 -04:00
Ikey Doherty
6e1ef76480 Cleanup invalid comments (duplication of words)
https://bugzilla.gnome.org/show_bug.cgi?id=735301

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2014-08-26 19:55:38 -04:00
Carlos Garnacho
2e7d5b22a1 wayland: Fix x/y coordinate arguments on wl_data_device events
Those are wl_fixed_t, not int.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-08-26 14:46:13 +02:00
Carlos Garnacho
001327d999 wayland: ensure gdk_device_manager_get_client_pointer() returns a master pointer
The internal ordering of devices isn't quite guaranteed, so ensure we're returning
the right one.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-08-26 14:46:13 +02:00
Carlos Garnacho
29d9b2f7cf wayland: unset sequence if the xdg surface is moved/resized through touch
The latest implicit grab serial is used in order to start the compositor
grab, If it belongs to a touch event, remove that touch sequence, as the
rest of the sequence will be gone for good.

This avoids stale sequences (and implicit grab info) after a window is
moved/resized.

https://bugzilla.gnome.org/show_bug.cgi?id=731380
2014-08-26 13:41:05 +02:00
Carlos Garnacho
2c36dc7592 wayland: Add internal API to unset a touch implicit grab
This removes both the wayland specific accounting, and the Gdk implicit
grab tracking.

https://bugzilla.gnome.org/show_bug.cgi?id=731380
2014-08-26 13:39:41 +02:00
Carlos Garnacho
6f789d5a78 wayland: Update the display serial on touch down/up events
https://bugzilla.gnome.org/show_bug.cgi?id=734374
2014-08-26 13:33:30 +02:00
Carlos Garnacho
537ff9fcad wayland: Improve implicit grab serial retrieval
_gdk_wayland_device_get_button_press_serial() has been replaced by
_gdk_wayland_device_get_implicit_grab_serial(), which takes a touch/pointer
event and figures out the relevant serial, and
_gdk_wayland_device_get_last_implicit_grab_serial() which returns
the most recent serial.

The button press serial was currently used when operating popping up
xdg_shell/surface popups and window menus, so this is now touch aware, of
some sort.

https://bugzilla.gnome.org/show_bug.cgi?id=734374
2014-08-26 13:32:46 +02:00
Carlos Garnacho
5b8641740b wayland: Store per-touch touch_down serial
https://bugzilla.gnome.org/show_bug.cgi?id=734374
2014-08-26 13:32:16 +02:00
Carlos Garnacho
12398c5d74 wayland: rename internal touch management functions
These functions arent quite related to the device manager, so rename these
more conveniently.

https://bugzilla.gnome.org/show_bug.cgi?id=734374
2014-08-26 13:31:52 +02:00
Carlos Garnacho
8f2d8dfa3b wayland: Protect against invalid keymaps gotten from the compositor
If the compositor sends a keymap that fails on "compilation",
xkb_keymap_new_from_string() returns NULL, which makes xkb_state_new()
crash when assuming there is a keymap.

In these cases, gdk must remain with a xkb_state to handle modifiers/keys
properly, so warn about the invalid keymap string, and keep the previous
keymap (currently initialized to "us")

https://bugzilla.gnome.org/show_bug.cgi?id=735389
2014-08-26 13:04:08 +02:00
Carlos Garnacho
ab6f771413 wayland: create a wl_subsurface interface for GDK_WINDOW_SUBSURFACE windows
This subsurface is currently dependent on the transient_for parent, so the
subsurface is repositioned relative to it.

https://bugzilla.gnome.org/show_bug.cgi?id=729215
2014-08-26 12:58:13 +02:00
Carlos Garnacho
ad9da99d86 wayland: Acquire wl_subcompositor interface
This will be needed for GDK_WINDOW_SUBSURFACE windows.

https://bugzilla.gnome.org/show_bug.cgi?id=729215
2014-08-26 12:58:13 +02:00
Carlos Garnacho
84414f0381 gdk: Add GDK_WINDOW_SUBSURFACE window type
This window type can only be used on wayland so far, so NULL is returned
if it's attempted to be used on any other windowing backend.

https://bugzilla.gnome.org/show_bug.cgi?id=729215
2014-08-26 12:58:13 +02:00
Carlos Garnacho
e206b72635 wayland: Make toplevels' X/Y coordinates be 0
To all effects each window has its own "root" coordinates system, so set
toplevels at 0,0 in that coordinate system, so root coordinate calculations
are locally right.

https://bugzilla.gnome.org/show_bug.cgi?id=729215
2014-08-26 12:58:13 +02:00
Jesse van den Kieboom
ec17a649ae gdkwindow-quartz: Support native fullscreen mode
This implements native fullscreen mode on OS X >= 10.7. This patch
adds tracking of the fullscreen mode if externally modified, as well
as toggling the native fullscreen mode of the window as needed.
2014-08-25 12:52:47 +02:00
Jasper St. Pierre
cd173a1b19 xdg-shell: Bump version 2014-08-22 12:06:09 -04:00