Commit Graph

6071 Commits

Author SHA1 Message Date
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
Carlos Garnacho
ba83a2757e wayland: Add defines to convert between event sequences and touch slots
This makes it clearer in code what's going on there.
GDK_SLOT_TO_EVENT_SEQUENCE isn't used yet, but will be useful in the
future.
2014-08-22 13:37:41 +02:00
Carlos Garnacho
88bf4a7a2d x11: Fix possible leak of GdkEvents
If the filter didn't return GDK_EVENT_TRANSLATE, the event struct would be
left unused and leaked.
2014-08-22 13:24:48 +02:00
Matthias Clasen
beae42c49b Include config.h first
Otherwise, we miss the _GNU_SOURCE #define that configure
puts there.
2014-08-21 14:22:13 -04:00
Simon McVittie
d329544e70 Use AC_USE_SYSTEM_EXTENSIONS to get _GNU_SOURCE, _XOPEN_SOURCE etc.
Similar to Bug #684123 in GLib.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=641638
Bug-Debian: https://bugs.debian.org/756476
Reviewed-by: Matthias Clasen
2014-08-21 09:54:12 +01:00
Sébastien Wilmet
55bd34c62a Mark the GdkColor struct as deprecated 2014-08-20 17:19:30 +02:00
Matthias Clasen
c9da8bf2b3 Revert "docs: Fix broken gtk-doc formatting"
This reverts commit a7562dd38f.

I prefer to not confuse gtk-doc with doc comments for private
functions.
2014-08-18 08:18:02 -04:00
Rico Tzschichholz
a7562dd38f docs: Fix broken gtk-doc formatting
Fixes broken introspection of GtkTranslateFunc
2014-08-18 13:27:05 +02:00
Matthias Clasen
1dfe28fa56 win32: Set the right source device
https://bugzilla.gnome.org/show_bug.cgi?id=734738
2014-08-15 13:04:57 -04:00
Domenico Tortorella
76da8a5f20 Fixed some object leaks in broadway_server_new() constructor.
https://bugzilla.gnome.org/show_bug.cgi?id=734778
2014-08-14 20:31:19 -04:00
Matthias Clasen
bd84bae5d9 Broadway: Make unix socket support conditional
We need to use gio/gunixsocketaddress.h and do so
only if HAVE_GIO_UNIX is defined.
2014-08-14 20:31:19 -04:00
Domenico Tortorella
43bddd205b BroadwayServer support for unix socket listening
At the present time broadway listens only for TCP/IP incoming
display connections. This patch implements the support for listening
on unix domain sockets too, adding the broadway_server_on_unix_socket_new()
constructor and the commandline option --unixsocket [path] to broadwayd.

https://bugzilla.gnome.org/show_bug.cgi?id=734420
2014-08-14 20:24:10 -04:00
Matthias Clasen
491cab3f7f Fix a thinko in creating event masks
&-ing together all the device event types yields zero,
which is clearly not the intention here. Use | instead,
to create the intended mask.

https://bugzilla.gnome.org/show_bug.cgi?id=734641
2014-08-14 00:10:23 -04:00
Руслан Ижбулатов
a0faf5a51c Fix various warnings
https://bugzilla.gnome.org/show_bug.cgi?id=734737
2014-08-13 23:41:56 +00:00
Руслан Ижбулатов
1b9fa975af Fix some print format warnings
https://bugzilla.gnome.org/show_bug.cgi?id=734736
2014-08-13 23:40:59 +00:00
Руслан Ижбулатов
694c8d32d5 Fix various warnings about unused things
https://bugzilla.gnome.org/show_bug.cgi?id=734735
2014-08-13 23:38:47 +00:00
Jasper St. Pierre
966b191e13 gdkwayland-window: Don't map the grab transfer menu for GtkMenu
This is a bad idea in general, but it also means that the focus for a
window drops when we pop up a menu, since the grab transfer menu exists.
2014-08-13 19:03:39 -04:00
Matthias Clasen
be5300f68e wayland: Initialize cursor cache earlier
Without this, I was getting a crash because the theme change
function was trying to iterate over the hash table before
it was created.
2014-08-12 13:43:22 -04:00
Jasper St. Pierre
a07fc2f85d wayland: Remove overly complex cursor cache 2014-08-10 12:34:56 -04:00
Chun-wei Fan
781846e564 gdkwindow-win32.c: Fix build on Visual C++
Since MSVC is more strict about the types that we try to do a compare, cast
old_ptr as HWND, as we know that it is a pointer...

https://bugzilla.gnome.org/show_bug.cgi?id=733768
2014-08-06 15:13:09 +08:00
Руслан Ижбулатов
31d08bd85e When wrapping a foreign W32 window, don't forget to store its HWND
When that window is later used as a parent for a GDK child, the call to
CreateWindow*() will fail, because its HWND is 0.

https://bugzilla.gnome.org/show_bug.cgi?id=733768
2014-08-05 06:37:24 +00:00
Руслан Ижбулатов
d43fb29c5a Suppress a warning from SetWindowLongPtr()
https://bugzilla.gnome.org/show_bug.cgi?id=726224
2014-08-04 13:55:11 +00:00
Руслан Ижбулатов
6dede1a0b7 W32: Don't crash when opacity is set for non-toplevel
X11 backend doesn't, and for good reason - main code body does not check
that the window it sets opacity for is, in fact, toplevel.
Just silently fail to do anything for non-toplevel windows.

https://bugzilla.gnome.org/show_bug.cgi?id=733769
2014-08-02 14:22:22 +00:00
Руслан Ижбулатов
a235dd6a6c GDK W32: add environment variable to override system font scaling
Support environment variable GDK_WIN32_FONT_RESOLUTION that can be set to
a desired dpi (72, 96, 130, etc) to override system settings. Useful for
debugging, since changing system font scaling requires the user to log off
and log on again.

https://bugzilla.gnome.org/show_bug.cgi?id=734038
2014-07-31 14:27:14 +00:00
Руслан Ижбулатов
f38498ed84 GDK W32: support font scaling
Respect system font scaling (Control Panel -> Display -> Font Size) and
convey that information to GDK (which then passes it to Pango).

https://bugzilla.gnome.org/show_bug.cgi?id=734038
2014-07-31 14:01:56 +00:00
Руслан Ижбулатов
a23c29c0fb W32: Implement rudimentary WM_NCHITTEST handling
Use (cairo) input shape of the window to check whether a point is inside or not
inside the window.
If it is, let the default window procedure do its thing (which seems to be
working all right in all known cases).
If it isn't, override the default window procedure and tell WM what we think.

Don't do any of the above if the window has CSD-incompatible styles (WS_BORDER
or WS_THICKFRAME).

This is a crude kind of substitute for window input shape support (which W32
does not seem to have). Still probably enough to be positive about input shapes
support.

https://bugzilla.gnome.org/show_bug.cgi?id=733679
2014-07-29 01:31:49 +00:00
Jasper St. Pierre
47d0be535b gdkdevice-wayland: Fix compile warnings
These are signed, not unsigned.
2014-07-26 09:47:14 -04:00
Jasper St. Pierre
61f0ed80a1 wayland-device: Upgrade to v4 of seat
Get our keyboard repeat info from the server.
2014-07-25 10:23:39 -04:00
Jasper St. Pierre
6c35ae199e wayland-device: Upgrade to v3 of seat
To prevent memory leaks.
2014-07-25 09:42:36 -04:00
Jasper St. Pierre
407a778bc5 wayland-device: Handle v2 of seat 2014-07-25 09:42:35 -04:00
Jasper St. Pierre
4eb2a74fb8 wayland-device: Refactor a bit
Delay the keyboard settings creation until we're delivering the key
press. This means we don't have to create the settings for a server that
sends us repeat information.
2014-07-25 09:42:35 -04:00
Jasper St. Pierre
ded609a735 wayland-device: Reindent 2014-07-25 09:42:35 -04:00
Руслан Ижбулатов
9e11bb3335 Remove gdk_win32_input_shape_combine_region()
This function currently calls gdk_win32_window_shape_combine_region(),
which is wrong, because it leads to SetWindowRgn() being called with
non-NULL region, which makes W32 disable theming (particularly - decoration
theming), which makes decorations revert back to old GDI-drawn Windows 2000
variant, which looks out of place and interacts *badly* with alpha channel
(because GDI).

https://bugzilla.gnome.org/show_bug.cgi?id=733671
2014-07-24 16:01:06 +00:00