Commit Graph

6558 Commits

Author SHA1 Message Date
Jonas Ådahl
3ab9d96623 wayland: Implement DND icon hotspot API
In Wayland, the hotspot of a DND icon is set using the buffer offset in
wl_buffer.attach. To implement this, add a private API to cause the
next wl_surface.attach to offset the new buffer with a given offset.
Setting a DND icon hotspot sets this offset while also queuing a redraw
of the window to trigger the wl_surface.attach.

https://bugzilla.gnome.org/show_bug.cgi?id=759168
2015-12-08 11:47:07 -05:00
Matthias Clasen
7d1a0b075d Trivial code restructuring 2015-12-07 21:57:45 -05:00
Matthias Clasen
3b4bfba37d wayland: Add a dummy implementation of gdk_drag_context_set_hotspot
This just records the hotspot coordinates. Still to do:
apply the hotspot when updating the drag window.
2015-12-07 21:53:38 -05:00
Matthias Clasen
475f6e09b1 x11: Implement gdk_drag_context_set_hotspot
This makes the drag behavior under X11 match what we had previously.
2015-12-07 21:52:51 -05:00
Matthias Clasen
f4ebdb64ee gdk: Add api to set drag window hotspot
With GdkDragContext now being in charge of placing the window,
it needs to know about the hotspot to place under the cursor.
2015-12-07 21:52:03 -05:00
William Hua
d2ef875e09 mir: remove deprecated function call 2015-12-04 11:17:43 -05:00
Lionel Landwerlin
bd332f10ab gdkoffscreenwindow: use embedder to derive surfaces & scale factor
In Gdk, a GdkOffscreenWindow parent has to be the root window. This is
problematic on Wayland because the root window doesn't necessary have the
right information with regard to scale factor.

This patch proposes to rely on the embedder, if available, to derive
surfaces as well as getting the scale factor.

https://bugzilla.gnome.org/show_bug.cgi?id=758936
2015-12-03 21:47:29 +00:00
Matthias Clasen
9fd6db87d2 Drop gdk_wayland_drag_context_get_dnd_window
This backend-specific and libgtk-only API is now unused,
so drop it.
2015-12-02 00:47:53 -05:00
Matthias Clasen
fff8297a50 Add gdk_drag_context_get_drag_window
This makes gdk_wayland_drag_context_get_dnd_window
backend-independent API and adds an implementation
for X11.
2015-12-01 23:47:56 -05:00
Benjamin Otte
d210ed7871 Revert "gdk_pixbuf_get_from_window: honor device scale"
This reverts commit 657a43e54e.

The commit breaks the assumptions about the arguments in both
gdk_pixbuf_get_from_window() and gdk_pixbuf_get_from_surface().

https://bugzilla.gnome.org/show_bug.cgi?id=757147
2015-12-02 00:29:29 +01:00
Benjamin Otte
9a1913dfb0 wayland: Remove unused variable
Poor gcc was unhappy.
2015-12-02 00:29:29 +01:00
Olivier Fourdan
f37aa415cd wayland: re-configure surface even if size matches
gdk-wayland backend would not re-configure a surface when its size and
scale match the known size and scale.

But there might be a pending xdg_surface_configure() that would revert
this change so we should re-configure even if the currently known
size/scale match, otherwise we may end up with a wrong size after the
xdg_surface_configure() is received.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=758901
2015-12-01 16:17:39 +01:00
Carlos Garnacho
1a394bd5ec wayland: Invert drop_finished/button release call order
If we "release" the button first, the drag will be eventually cancelled,
we must first signal GDK_DROP_FINISHED, and then release the button so
the success status prevails.
2015-12-01 15:49:13 +01:00
Carlos Garnacho
0ad927adca wayland: Store requested target on GdkWaylandSelection
It doesn't make a lot of sense to have this stored as data offer data,
rather together with the source_targets array, which is what we're
poking here in the end.

https://bugzilla.gnome.org/show_bug.cgi?id=758713
2015-12-01 15:49:13 +01:00
Carlos Garnacho
4f9d0c06ef wayland: Refactor selection ownership
Dissociate ownership from our maintenance of wl_data_source objects.
The only place where ownership must be updated together is
data_source.cancelled, for the other places GDK should take care of
setting up the right ownership, even if at a different order than
we'd expect here.

This fixes GTK+ apps on wayland being locally confused about the
current selection ownership. Because gtk_selection_add_targets()
results in a wl_data_source being created, and ownership being
updated right away, early callers of this will change the ownership
even if the widget it's being called on didn't explicitly request
the selection ownership yet.

https://bugzilla.gnome.org/show_bug.cgi?id=758660
2015-11-30 20:37:25 +01:00
Руслан Ижбулатов
3701a60401 GDK W32: Add a comment for clarity
This is a copy of a similar comment in another place, which explains
why WS_EX_TRANSPARENT windows get a special treatment.

https://bugzilla.gnome.org/show_bug.cgi?id=758484
2015-11-26 17:58:47 +00:00
Руслан Ижбулатов
8b7783ce21 GDK W32: Clarify the use of the second argument to SetWindowPos()
https://bugzilla.gnome.org/show_bug.cgi?id=758484
2015-11-26 17:58:46 +00:00
Руслан Ижбулатов
db1b24233e GDK W32: Don't use SetWindowLong() to set/unset WS_EX_TOPMOST
While searching for the cause of bug 746745 it was discovered that one could
not set WS_EX_TOPMOST extended window style with SetWindowLong(),
but must use SetWindowPos() for that purpose.

This was never a problem most likely because it is highly unlikely for windows
to acquire/lose WS_EX_TOPMOST after they are created, by means other
than SetWindowPos() (which GTK does use to raise/lower windows and
set/remove keep_above), and because trying to set/unset WS_EX_TOPMOST with
SetWindowLong() results in WS_EX_TOPMOST merely not being set/unset (that is,
other styles are still set/unset within the same call and no error is
signalled).

https://bugzilla.gnome.org/show_bug.cgi?id=758483
2015-11-26 16:26:32 +00:00
Jonas Ådahl
1e11b55606 wayland: Use xdg shell protocol from wayland-protocols
Drop our own copy of the xdg shell XML file, and use the one installed
by wayland-protocols.

https://bugzilla.gnome.org/show_bug.cgi?id=758634
2015-11-26 16:54:32 +08:00
Jonas Ådahl
912e79dbe2 wayland: Use pointer gestures protocol from wayland-protocols
Instead of having our own copy of the pointer gestures XML file, use
the one installed by wayland-protocols.

Since pointer gestures is an unstable protocol, it went through the
unstable protocol naming convention changes, which is reflected in this
commit.

https://bugzilla.gnome.org/show_bug.cgi?id=758634
2015-11-26 16:54:32 +08:00
Carlos Garnacho
de7e27bc97 wayland: remove embarrassing g_print()s 2015-11-24 20:57:03 +01:00
Carlos Garnacho
5f59d7de1e wayland: Do not store the grab cursor separately
After the grab is finished, we would expect an enter event, and
GDK updating internally the cursor for that window and device.
This means there is no need at all to store it separately in the
backend.

As a side effect, animated cursors are now also possible on grab
icons.

https://bugzilla.gnome.org/show_bug.cgi?id=735847
2015-11-24 20:52:12 +01:00
Carlos Garnacho
cc2e77295e device: Fix dispose
The way master devices detach from their other master counterpart is
vulnerable to infinite recursion due to the way we first recurse on
the other device before clearing the pointer, this may happen if
that last reference to the other master device is held by the
device->associated field.

https://bugzilla.gnome.org/show_bug.cgi?id=732742
2015-11-24 20:52:12 +01:00
Carlos Garnacho
d62febcf97 wayland: Plug surface leak
Other backends take care of the cairo surface destruction in
GdkWindow::destroy. We must do the same here, or the cairo_surface
and its corresponding wl_buffer are left dangling.

https://bugzilla.gnome.org/show_bug.cgi?id=747295
2015-11-24 20:52:12 +01:00
Руслан Ижбулатов
f407871b87 GDK W32: Only restack windows with matching always-on-top status
This prevents normal application windows (and other kinds of windows)
from being moved up in Z-order to be above windows that have the
always-on-top bit set. Doing so would make the previously-normal windows
in question also always-on-top implicitly.
Windows that are already always-on-top will be restacked on top of other
always-on-top windows too.

https://bugzilla.gnome.org/show_bug.cgi?id=746745
2015-11-22 03:20:10 +00:00
Руслан Ижбулатов
6b7951b219 GDK W32: Refactor restacking functions a bit 2015-11-22 03:18:43 +00:00
Jonas Ådahl
dc65abc44c wayland: Set a null cursor surface when cursor buffer is null
If the buffer of a cursor is NULL, for example if its an empty cursor,
just set the cursor surface to NULL as well. Not doing this we'll use
uninitialized hotspot coordinates, dimensions and scales.

https://bugzilla.gnome.org/show_bug.cgi?id=758025
2015-11-20 11:59:46 -05:00
Carlos Garnacho
c4f5fd111c wayland: Ensure we have a drop-side GdkDragContext without pointer
This GdkDragContext should be created even if we don't have pointer
capabilities. Make it created on add_seat(), and only set the device
on wl_seat.capabilities, so it can be set to either master pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=741066
2015-11-20 00:11:33 +01:00
Carlos Garnacho
ec65c6d1ce wayland: Fix toplevel lookup before starting DnD
We use the high-level gdk_device_get_window_at_position() to figure
out the window, although this one actually tries to find out the
current window under the device coordinates, which might well fall
outside the window, so NULL is returned in those cases.

Fix this by using the lower level _gdk_device_window_at_position()
that will return the toplevel without further lookups, so is more
desirable here.

https://bugzilla.gnome.org/show_bug.cgi?id=758250
2015-11-19 23:27:26 +01:00
Carlos Garnacho
d221119d14 wayland: Implement GdkDevice::window_at_position for touch
This goes through its own master pointer, so look up the pointer
emulating touch focus window and coordinates.
2015-11-19 23:26:48 +01:00
Carlos Garnacho
c405f810cd wayland: Disallow setting the cursor on the touch master pointer
That "pointer" is not backed by anything in the windowing system, ignore
cursor updates there.
2015-11-19 23:26:48 +01:00
Carlos Garnacho
a72974252f wayland: Ensure we get the master pointer on GdkDeviceManager::get_client_pointer
Now that we have multiple master pointers, this call may pick the wrong one.
Instead, pick the GdkWaylandDeviceData from the first device, and pick the
master pointer from there.
2015-11-19 23:26:48 +01:00
Carlos Garnacho
04ecffa238 wayland: Separate touch pointer emulation into its own master pointer
The common GDK code accounts for "pointer emulating" touch sequences to be
synchronized with the pointer position by the windowing system.

However on Wayland pointer and touch are completely independent, the backend
attempts to implement pointer emulation, but doesn't account for the
possible crossing events happening when the user switches from pointer to
touch or the opposite.

In order to fix this, and to ensure we don't have to interact with the
master pointer (which backs the wl_pointer), separate the touch interface
to have its own master pointer, and ensure crossing events are emitted on
it, so the picture of an "emulated pointer" is complete above the backend.

Inspired in a former patch by Jonny Lamb <jonnylamb@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=750845
2015-11-19 23:26:48 +01:00
Matthias Clasen
12a692ea9d wayland: Avoid a crash
We can end up in situations where NULL gets passed to
get_transient_parent(). Embrace it instead of avoiding it.

https://bugzilla.gnome.org/show_bug.cgi?id=758327
2015-11-19 14:40:55 -05:00
Matthias Clasen
7435c87775 Document GDK_TOUCHPAD_GESTURE_MASK 2015-11-19 06:05:15 -05:00
Carlos Garnacho
4c49c0a297 wayland: Move additional pointer buttons after the old 4-7 scrolling ones
We were using that range for the extra buttons after left/right/middle,
while this is harmless for clients not handling extra buttons (we
used to translate those button events into scroll events in x11 anyway)
this will be unexpected for clients that do handle additional mouse
buttons themselves (eg. back/forward buttons present in some mice).

In order to remain compatible with X11, those need to be assigned from
button 8 onwards.

Also, include input.h, and stop using magic numbers here.

https://bugzilla.gnome.org/show_bug.cgi?id=758072
2015-11-17 22:41:22 +01:00
Carlos Garnacho
c5b7cd97b6 x11: Add "pointer" to the is-not-a-touchscreen device name checks
Commit 1266d15c4 also broke Xwayland, as it does the same trick
than VMWare pointers. Let's extend the heuristic to check for "pointer"
in the device name, what can possibly go wrong...

https://bugzilla.gnome.org/show_bug.cgi?id=757358
2015-11-17 16:22:06 +01:00
Matthias Clasen
c659292940 x11: Try harder to find a core pointer
We currently just look for a master device with input source MOUSE.
After recent changes to the way input devices are classified, xwayland
on my system comes up with a virtual core pointer that has input
source TOUCHSCREEN. This was causing assertion failures. Be a little
more careful and accept a touchscreen as core pointer, if there is
no mouse.
2015-11-16 18:34:18 -05:00
Carlos Garnacho
b32c7c3282 x11: Do not misdetect mice with abs axes as touchscreens
VMWare seems to create mouse devices with abs axes which confuses
our detection of single-touch touchscreens. Those have though a
name we can match on ("VirtualPS/2 VMware VMMouse"), it should
be pretty safe to assume that no real touchscreens have "mouse"
in their name...

https://bugzilla.gnome.org/show_bug.cgi?id=757358
2015-11-14 23:45:46 -05:00
Rui Matos
bc6d2d65fb wayland: Translate virtual modifiers too
Wayland allows us to receive virtual modifiers too so we can just use
them directly if the compositor does send them.

https://bugzilla.gnome.org/show_bug.cgi?id=748904
2015-11-14 23:26:11 -05:00
Ignacio Casal Quinteiro
d74a08b80f win32: do not use g_clear_pointer also on the clipboard window
A follow up on the previous patch. We should use DestroyWindow
directly since it has a different calling convention than
the expected callback for g_clear_pointer
2015-11-13 12:58:45 +01:00
Ignacio Casal Quinteiro
2ad243d43d win32: do not use g_clear_pointer to destroy the window
DestroyWindow expects a different calling convenction so
we endup getting an error at runtime
2015-11-13 12:57:53 +01:00
Ignacio Casal Quinteiro
1f5f3ca41b win32: destroy clipboard notification window on dispose
The clipboard uses a hidden window to get some specific events.
The window was created but never destroyed on dispose.
2015-11-12 17:09:25 +01:00
Ignacio Casal Quinteiro
79f7f19c6e win32: chain up on display dispose 2015-11-12 16:00:53 +01:00
Alexander Larsson
09a181d205 gdk: Fix invalidation w/ pixel cache when changing child window geometry.
When moving/scrolling a child window we can't use the current clip
region to limit what is invalidated, because there may be a pixel
cache that listens for changes outside the clip region. Instead
invalidate the entire area and rely on the invalidation code to limit
the repaint to the actually visible area.
2015-11-09 17:06:00 +01:00
Emmanuele Bassi
452e303ec0 docs: Fix typo in gdk_screen_get_scale_factor() 2015-11-04 11:45:19 +00:00
Carlos Garnacho
7d8a3a52ce GdkDevice: Do not free construct-only properties data on dispose()
Those are not references to other objects, and the device will be mostly
useless if those can't be set again anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=756625
2015-11-03 13:28:07 +01:00
Carlos Garnacho
29dd395b7a x11: Detect single-touch touchscreens as GDK_SOURCE_TOUCHSCREEN
Those won't have ABS_MT_* axes, so won't be reported has having
XITouchClassInfo. Fallback on these to checking whether abs x/y axes are
available. After the Wacom checks, any remaining device with absolute axes
should be touchscreens, and GDK_SOURCE_MOUSE does indeed just make sense on
devices with relative axes.

https://bugzilla.gnome.org/show_bug.cgi?id=757358
2015-11-03 07:07:12 -05:00
Benjamin Otte
96a485d8b2 gdkrgba: Use %g instead of %.17g to print alpha
This way 0.3 isn't printed as 0.29999999999999
2015-11-02 20:32:12 +01:00
Cemil Azizoglu
9e2b796e77 mir: Print hscroll and vscroll values when debugging.
Signed-off-by: William Hua <william.hua@canonical.com>
2015-11-02 10:46:37 -05:00
Paolo Borelli
8606e57910 win32: handle WM_DISPLAYCHANGE globally
Instead of handling WM_DISPLAYCHANGE on every GdkWindow, only handle
it on an ad-hoc hidden window we create when opening the display.
This has two reasons:
1) we want emit the display::size-changed signal even if there are no
   gtk windows currently open
2) we want to emit the signal just once and not once for every window

https://bugzilla.gnome.org/show_bug.cgi?id=757324
2015-10-31 15:31:11 +01:00
Olivier Fourdan
3058c3e6a9 wayland: configure clients that resize themselves
Make sure the wayland backend sets a new geometry when the client
resizes itself, otherwise the compositor won't be notified and may
revert to the old size on state changes.

Thanks to Jasper St. Pierre <jstpierre@mecheye.net> who pointed out the
problem in gtk+.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=755051
2015-10-28 08:41:17 +01:00
William Hua
1760ada1ff mir: emulate pointer for all touch events 2015-10-27 16:37:21 -04:00
William Hua
6f340d4384 mir: warning clean-up 2015-10-27 10:50:18 -04:00
William Hua
c3b0b8a360 mir: allow logging touch events 2015-10-27 10:11:43 -04:00
Lars Uebernickel
71b31c84c0 gdkpixbuf-drawable: reinstate accidentally removed line 2015-10-27 13:38:14 +01:00
Lars Uebernickel
657a43e54e gdk_pixbuf_get_from_window: honor device scale
gdk_pixbuf_get_from_window() paints the given window onto a new cairo
surface. Create that new surface with the same device scale as the
window so that the result is not scaled down on hidpi screens.

https://bugzilla.gnome.org/show_bug.cgi?id=757147
2015-10-27 09:38:52 +01:00
Robert Ancell
aefa1ba611 gdk: Deprecate gdk_display_get_screen 2015-10-27 14:17:52 +13:00
Jonas Ådahl
db04c1eda7 wayland: Don't use GTK symbols from GDK
GTK_WINDOW_POPUP sets the GdkWindow type to GDK_WINDOW_TEMP, so use
that in GDK, not the GTK symbol which doesn't exist there.
2015-10-27 09:02:35 +08:00
Jonas Ådahl
bcb28adba3 wayland: Map UTILITY hinted popup windows as subsurfaces
Currently used by GtkTreeView to map windows without changing focus. We
can't map this as a popup, because popup implies focus change.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Jonas Ådahl
e25ea62f22 wayland: Don't try to use subsurfaces as popup parents
If a GtkMenu (or something else that is mapped as a xdg_popup) tries to
use a subsurface window as a parent, it will be terminated by the
compositor due to protocol violation. So to avoid this, if a parent
window is not a xdg_popup or xdg_surface, i.e. a wl_subsurface, then
traverse up the transient parents until we find the right popup parent.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Jonas Ådahl
49798754e6 wayland: Make window type conditions switches
In order to make it easier to add/remove in future commits.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Matthias Clasen
7c7fde136e Translate GDK_KEY_KP_Decimal according to locale
It makes sense that you should be able to type numbers that are
correctly formatted and parsable according to the current locale,
using just the keypad. This patch makes it so by translating
GDK_KEY_KP_Decimal to the decimal separator for the current locale,
instead of hardcoding a '.'.

https://bugzilla.gnome.org/show_bug.cgi?id=756751
2015-10-25 13:59:48 -04:00
Matthias Clasen
64c5b97be8 quartz: Don't use the instancetype keyword
gdkcursor-quartz.c uses the instancetype keyword, which doesn't seem to
be supported in the version of Objective C that Snow Leopard uses.
Replacing that keyword with the thing it represents makes it build.

Patch by Ryan Hendrickson,
http://bugzilla.gnome.org/show_bug.cgi?id=756770
2015-10-25 13:26:01 -04:00
Matthias Clasen
f703ea6599 win32: Fix introspection syntax 2015-10-22 11:50:49 -04:00
Matthias Clasen
4d59233ba9 Don't use g_slist_next in the x11 backend
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
364d1a574b Don't use g_slist_next in the windows backend
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
ffa98cbfa5 Don't use g_slist_next in gdk
We generally just use ->next directly.
2015-10-20 06:14:57 -04:00
Jonas Ådahl
f838743bc0 wayland: Map windows with tooltip hint as subsurfaces
Tooltips tend to be placed on top of a parent surface with a given
relative coordinate, and without any input focus. So lets map them as
subsurfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=756496
2015-10-18 21:32:22 +08:00
Jonas Ådahl
9fe40f9a46 wayland: Clean up code determining how to map a window
Restructure the mapping procedure so that its known up front what the
expected way mapping is to be done (subsurface, popup or stand alone),
and warn if it fails to actually map in such a way (for example a popup
without a parent or device grab, a tooltip without a parent).

https://bugzilla.gnome.org/show_bug.cgi?id=756496
2015-10-18 21:32:22 +08:00
Matthias Clasen
25483304cd Minor cleanup
Replace a unref-and-unset combination with g_clear_object.
2015-10-17 12:48:55 -04:00
Matthias Clasen
c860492359 Clean up handling of _gdk_win32_grab_cursor
This is a variable holding a ref to an object, so it is
a great case to use g_set_object and g_clear_object.

 # Please enter the commit message for your changes. Lines starting
2015-10-17 12:45:25 -04:00
Руслан Ижбулатов
00b39e4a82 W32: Add missing reference taking in gdk_device_virtual_grab()
https://bugzilla.gnome.org/show_bug.cgi?id=756160
2015-10-17 16:39:58 +00:00
William Hua
027b02a371 mir: send touch events 2015-10-16 10:51:36 +01:00
Ignacio Casal Quinteiro
c888a927e7 win32: fix warnings about signed/unsigned mismatch 2015-10-16 09:22:39 +02:00
Ignacio Casal Quinteiro
342b620223 win32: use the same type as the prototype 2015-10-16 09:07:32 +02:00
William Hua
af5792f141 mir: support more pixel formats 2015-10-14 09:21:41 +01:00
Olivier Fourdan
4398e12469 GdkAppLaunchContext: Use the display name for X11
Using a NULL GAppInfo with g_app_launch_context_get_display() will
generate a critical warning in gio.

Use the display name instead as we don't have any valid GAppInfo to pass
to g_app_launch_context_get_display().

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756439
2015-10-13 08:39:05 +02:00
Carlos Garnacho
7ab250c10c wayland: Set a more believable crossing detail on pointer enter/leave
GDK_NOTIFY_ANCESTOR would happen when the pointer crosses across a direct
parent/child. However nonlinear events are more likely, specially when
the pointer moves across toplevels (either different apps, or menus being
popped up over the pointer position).

This makes popping up comboboxes and other menus that fall over the pointer
position possible. With the previous detail the GtkMenu code misinterpreted
the crossing event, making it think the button release coming right after
should dismiss the popup, which made menus just flash on the screen unless
you kept the button pressed.
2015-10-13 02:07:23 +02:00
Ignacio Casal Quinteiro
22b0ed6807 win32: use the same parameter name as the implementation 2015-10-08 18:07:49 +02:00
Emmanuele Bassi
f10c0da36c wayland: Allow falling back to compatibility EGL contexts
If the shared context is in legacy mode, or if the creation of a core
profile context failed, we fall back to an EGL context in compatibility
mode.

Since we're relying on a fairly new EGL implementation for Wayland, we
don't fall back to the older EGL API, and instead we always require the
EGL_KHR_create_context extension.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
59d02afec0 docs: Improve description of gdk_gl_context_is_legacy()
Explain why this function is available, and why you may need it.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
105f1c9fd3 Control legacy GL context via environment variable
For testing purposes, we may want to force the creation of legacy GL
contexts via an environment variable.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
18cae47e17 x11: Create legacy GLX contexts
If GLX has support for the GLX_ARB_create_context_profile extension,
then we use the GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; if it does
not, we fall back to the old glXCreateNewContext() API.

We use the shared GdkGLContext to decide whether the GLX context should
use the legacy bit or not.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
e636c316a6 gl: Use older GLSL shaders with legacy contexts
If we're using modern GLSL, then we should stop using deprecated
modifiers, like 'varying' and 'attribute', as well as deprecated global
variables, like 'gl_FragColor'.

On the other hand, with legacy contexts we should be using older GLSL
shaders, to maximize compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
24230ca783 gl: Store the legacy bit in the GL program data
We need to know if we're using a legacy GL context in various places.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
2dfca143bb gdk: Allow querying if a GL context is in legacy mode
We want to have the ability to fall back to legacy GL contexts when
creating them. In order to do so, we need to store the legacy bit on the
GdkGLContext, as well as being able to query it.

Setting the legacy bit from outside GDK is not possible; we cannot
create GL contexts in 3.2 core profile *and* compatibility modes at the
same time, and if we allowed users to select the legacy mode themselves,
it would break the creation of the GdkWindow's paint GL context.

What we do allow is falling back to legacy GL context if the platform
does not support 3.2 core profiles — for instance, on older GPUs or
inside virtualized environments.

We are also going to use the legacy bit internally, to choose which GL
API we can use when drawing GL content.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Jonas Ådahl
dad1931b5f wayland: Don't ignore wl_keyboard.leave if surface is gone
keyboard_handle_leave() might be called with a NULL surface resource
(for example if the surface was destroyed after the event was sent). If
so, we should still deal with the keyboard focus lost event, otherwise
we will both leak (the keyboard_focus GdkWindow reference) and miss
stopping the key repeat timer.

https://bugzilla.gnome.org/show_bug.cgi?id=755927
2015-10-07 12:28:39 +08:00
Olivier Fourdan
ecb0e777fa GdkAppLaunchContext: Set DISPLAY variable for X11
The environment variable DISPLAY makes sense only for X11, so set its
value in the X11 backend.

https://bugzilla.gnome.org/show_bug.cgi?id=754983
2015-10-05 23:40:56 -04:00
Benjamin Otte
2dad7c1319 gdk: Add gdk_rectangle_equal()
There's enough users inside GTK to warrant this convenience function.
2015-10-03 22:26:27 -04:00
Benjamin Otte
cc2224cc62 gdk: Add version macros for 3.20 2015-10-03 22:24:17 -04:00
Matthias Clasen
65ec902df9 Remove overhead in gdk_window_get_user_data
This function is called very frequently during in GTK+'s drawing
paths, and thus should not carry unexpected costs.
2015-09-28 06:29:50 -04:00
Emmanuele Bassi
020af23296 build: Dist toarray.pl
Some distributions (MSYS2, Debian) call autoreconf on a tarball because
they change the autotools artifacts.

In order to rebuild the Broadway generated files, we need to ship the
scripts that we use when disting a release.
2015-09-24 08:29:30 +01:00
Alexander Larsson
ee883a2ef5 gdkwindow: Fix list_insert_link_before
We forgot to set prev->next to the new link
2015-09-21 16:59:51 +02:00
Alexander Larsson
9bda0532f8 gdk: Finish conversion to in-struct GdkWindow list nodes 2015-09-21 16:59:51 +02:00
Benjamin Otte
15d043c5d2 gdk: Mark window surfaces as dirty before reading from them
We do not know what happened to this surface outside of GDK.
Especially for foreign windows, they will have been modified
by external applications.

So be on the safe side and tell Cairo to clear all its caches.

https://bugzilla.gnome.org/show_bug.cgi?id=754952
2015-09-18 02:06:01 +02:00
Carlos Garnacho
603ea3b3e7 wayland: Avoid running stale cursor animation timeouts
gdk_wayland_device_update_window_cursor() is inconsistently returning
TRUE/FALSE, despite the timeout being always replaced for new cursor
frames. This could end up in these timeouts being "leaked" and running
as long as the window has an animated cursor.

Fix this by making it really sure we return G_SOURCE_REMOVE, although
now we keep track of animation delays, so the timeout will be reused
for constant time animations.
2015-09-16 19:19:49 +02:00
Chun-wei Fan
6423a02c55 MSVC Builds: Massive Rename of Projects
We need to rename the projects so that when these projects are added
into an all-in-one solution file that will build the GTK+ 2/3 stack,
the names of the projects will not collide with the GTK+-2.x ones,
especially as GTK+-2.x and GTK+-3.x are done to co-exist on the same
system.  This is due to the case that the MSVC projects are directly
carried over from the GTK+-2.x ones and was then updated for 3.x.

We still need to update the GUIDs of the projects, so that they won't
conflict with the GTK+-2.x ones.
2015-09-15 18:51:33 +08:00
Chun-wei Fan
d836a52b68 build: Clean Up Visual Studio Project Generation
Use the common automake module from the previous commit in the
Makefile.am's, which means that the Makefile.am's in gdk/ and gtk/ can be
cleaned up as a result.  As a side effect, the property sheet that is used
to "install" the build results and headers can now be generated in terms of
the listing of headers to copy during 'make dist', where we can acquire
most of the list of headers to "install", so that we can largely avoid the
situation where the property sheet files are not updated in time for this,
causing missing headers when this build of GTK+ is being used.

Also use the Visual Studio Project file generation for the following
projects:
gtk3-demo
gtk3-demo-application
gtk3-icon-browser
gdk-win32
gdk-broadway
gail-util

So that the maintenace of these project files can be simplified as well.

https://bugzilla.gnome.org/show_bug.cgi?id=681965
2015-09-15 18:37:37 +08:00
Jonas Ådahl
7c4c8b90f0 wayland: Make subsurface desynchronized after first parent surface frame
Initially the subsurface will be in synchronized mode and we will leave
it like this until the first time the parent surface has been committed.
The reason for this is because the subsurface position will be applied
as part of the parent surface state, and we need to synchronize the
initial position with the initial frame, so that we don't accidentally
draw the subsurface at the default position (0, 0) which would happen in
desynchronized mode if the subsurface content is committed before the
next parent surface commit.

https://bugzilla.gnome.org/show_bug.cgi?id=754839
2015-09-15 08:11:47 +08:00