Commit Graph

7368 Commits

Author SHA1 Message Date
Olivier Fourdan
19ce6a8bc5 gdkwindow: subsurface in gdk_window_get_parent()
When the GtkWidget hierarchy does not match the GdkWindow hierarchy, the
GtkWidget code may find a common ancestor that cannot be found while
traversing the GdkWindow tree using gdk_window_get_parent().

This happens with for example on Wayland, a GtkPopover has another
GtkPopover as parent, in this case, the GdkWindow parent is the root
window, whereas the GtkWidget parent is the other GtkPopover.

That confuses the gtk_widget_translate_coordinates() logic which will
bail out in this case and won't return the translated coordinates.

Make gdk_window_get_effective_parent() aware of subsurfaces and use the
transient_for which represents the actual parent (whereas the parent
might be pointing to the root window).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=774148
2017-03-30 15:46:25 +02:00
Matthias Clasen
2761fae728 Work around a wayland crash
For some reason, we are seeing damage being NULL here.
While that should never be the case, crashing on it is
unkind and makes the Wayland experience unusable.
2017-03-30 09:15:29 -04:00
Matthias Clasen
6963d9e2ee Avoid unused variable warnings 2017-03-23 16:15:00 +00:00
William Hua
e69b4dc3da mir: always emit a resize when creating windows 2017-03-22 02:21:43 -04:00
Timm Bäder
ec2062498f glcontext: Fix buffer age comparison
The old code had a dead >=3 branch, causing flickering.
2017-03-21 19:04:58 +01:00
Timm Bäder
12b7d30a2d GdkWaylandWindow: Force window titles to valid utf8
Use the new g_utf8_make_valid in case the given title is not valid utf8.
Also bump the glib requirement to 2.51.5.
2017-03-20 20:04:26 +01:00
Timm Bäder
60ed515be9 GdkX11DeviceManager: Fix debugging output
The 2 values added in 3.22 were missing from the source_names array.
2017-03-19 15:44:15 +01:00
Timm Bäder
c78451e140 GdkMonitor: Use 1 as scale fallback value
The same value we use in gtk_widget_get_scale_factor.
2017-03-19 15:44:15 +01:00
Timm Bäder
56e809be9c GdkDrawingContext: Add missing break in switch statement 2017-03-18 07:07:06 +01:00
Murray Cumming
158015be6c
docs: Remove mentions of gtk_init_with_args().
Because it has been removed: See commit 7e8eb3ddcd
2017-03-17 21:12:12 +01:00
Christoph Reiter
b843efcb79 quartz: fix build for <10.12
The style mask type was changed from NSUInteger to NSWindowStyleMask.
Use NSUInteger so it also works on older macOS.

https://bugzilla.gnome.org/show_bug.cgi?id=780019
2017-03-15 07:18:48 -04:00
William Hua
05ca583515 mir: start handling resize events again 2017-03-13 10:52:42 -04:00
William Hua
3eb8694cbd mir: remove unused generate_configure_event () 2017-03-13 04:07:54 -04:00
William Hua
64753532ba mir: set placement for menu-type windows 2017-03-13 03:36:30 -04:00
William Hua
3914bcd678 mir: synthesize resize events 2017-03-13 02:52:15 -04:00
William Hua
24dc2d8986 mir: ignore resize events 2017-03-13 00:06:30 -04:00
William Hua
0c1cbcfe60 mir: try mir before x11 2017-03-12 22:40:04 -04:00
Matthias Clasen
e02924a77d quartz: Fix another typo 2017-03-10 07:26:05 -05:00
Matthias Clasen
0cb0542673 quartz: Fix the build
A ; was left out inadvertently.
2017-03-10 07:12:12 -05:00
William Hua
0b72eee311 mir: log additional event types 2017-03-09 23:42:41 -05:00
William Hua
dbb3f84796 mir: don't create GDK_INPUT_ONLY windows 2017-03-06 10:36:45 -05:00
Matthias Clasen
8531ee4c88 Quartz: Implement gdk_window_set_functions
This is useful, and easy to implement.
2017-03-05 22:52:03 -05:00
Timm Bäder
e1592c599e gdkwindow: Plug memory leak
gdk_drawing_context_get_clip returns a newly allocated cairo_region_t,
so we have to destroy it.
2017-03-02 15:16:08 +01:00
Matthias Clasen
015ff46633 Convince OS X to fully fullscreen windows
We typically want to have the full screen given to
the content, not the aspect-ratio preserving behavior
that newer OS X has.

https://bugzilla.gnome.org/show_bug.cgi?id=779383
2017-03-02 08:10:39 -05:00
Matthias Clasen
6278d003b4 Implement backdrop for Quartz
We need to send window state change events to make GTK+
pick up on focus changed for backdrop.

https://bugzilla.gnome.org/show_bug.cgi?id=779392
2017-03-01 11:47:18 -05:00
Matthias Clasen
169e2d8d92 quartz: Let CSD windows be fullscreen
I've found that I need this patch to make it possible for
windows with headerbar to be made fullscreen on OS X.

https://bugzilla.gnome.org/show_bug.cgi?id=779383
2017-03-01 11:46:31 -05:00
Olivier Fourdan
bbf7c6a715 wayland: make sure to clear up the number of keys
Make sure to clear up the number of keys being pressed on enter/leave so
that we don't end up with leftovers if a new window is mapped by a
keyboard shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=779374
2017-03-01 16:10:44 +01:00
William Hua
54791b65bd mir: deprecate gdk_mir_window_get_mir_surface () 2017-03-01 02:15:56 -05:00
William Hua
f98e3dd09a mir: delete commented debug output 2017-03-01 02:15:56 -05:00
William Hua
bdf559c623 mir: migrate away from deprecated mir api 2017-03-01 02:15:56 -05:00
William Hua
e07dea5d97 mir: move #include to correct file 2017-03-01 02:15:56 -05:00
Olivier Fourdan
4c533e17f5 wayland: do not cancel key repeat on key press
The key repeat is stopped as soon as a key is pressed, so if the user
quickly presses a key while another is already pressed and being
repeated, key repeat gets cancelled:

 - key1 press
 - key1 repeat
 - key2 press -> key1 repeat stopped
 - key1 release
 - key 2 is not repeated even though it's kept depressed

This is a different behavior from X11, which confuses migrating users.

To mimic the X11 behavior, keep track of the number of keys pressed
simultaneously and cancel key repeat only when none is pressed.

This way, if a user pressed a key while another one is being repeated,
the new key press can possibly be repeated as well.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=778019
2017-02-27 11:53:03 +01:00
Olivier Fourdan
83b54bab57 wayland: Fix a race condition with xdg_popup resize
When resizing an xdg_popup immediately after the initial mapping, there
is a race condition between the client and the compositor which is
processing the initial size given by the xdg_positioner, leading to the
xdg_popup to be eventually of the wrong size.

Only way to make sure the size is correct in that case is to hide and
show the window again. Considering this occurs before the initial
configure is processed, it should not be noticeable.

https://bugzilla.gnome.org/show_bug.cgi?id=772505
2017-02-24 10:07:17 +01:00
Carlos Garnacho
9029bc0f6a gdk: Ensure GdkDragContext instantly updates drag window position
Otherwise we wait for the next gdk_drag_motion() call, which will
happen on the next motion event, making the drag window briefly visible
on the 0,0 root coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=778203
2017-02-17 19:35:42 +01:00
Olivier Fourdan
afa78fcffe wayland: do not clamp anchor values
Clamping the anchor values as introduced in commit 9a5ffcd to fix bug
777176 breaks menu positioning.

By keeping the anchors rectangle size greater than zero, we end up
deducting some positive value from the original position, so there is no
need to clamp() actually, keeping the values positive is enough and
avoids the issue with menu positioning on the menubar.

An additional benefit is to make the code a lot simpler.

https://bugzilla.gnome.org/show_bug.cgi?id=778009
2017-02-06 09:29:38 +01:00
Timm Bäder
a728a2e061 Never return NULL from gdk_get_program_class
gdk_init is not calling g_set_prgname anymore, so just return a dummy
string from gdk_get_program_class if it has not been set before.
2017-02-05 15:03:35 +01:00
William Hua
2088cc3395 mir: handle surface placement events
This allows the Mir backend to properly emit "moved-to-rect."
2017-01-30 03:06:59 -05:00
William Hua
b09b69472b mir: use mir_surface_spec_set_placement for menus
This API was added to Mir for GTK menus, combo boxes, etc.
2017-01-30 03:06:01 -05:00
Carlos Garnacho
4ebf98f440 wayland: Ensure to set gtk_surface dbus properties after hide()
Currently hiding destroys the wl_surface and all related interfaces,
(including the gtk_surface1) so the next time the GdkWindow is mapped,
we don't bother to set the DBus properties. Toggle the check off so
it's actually issued again after the GdkWindow gets a gtk_surface1.

https://bugzilla.gnome.org/show_bug.cgi?id=773686
2017-01-25 18:12:51 +01:00
Carlos Garnacho
f686dfb575 Revert "wayland: Push NULL buffer when hiding a GdkWindow"
This reverts commit 6beb0b91c9.
2017-01-20 14:04:37 +01:00
Matthias Clasen
4d7fa52fe9 Drop gdk init api
Supporting separately initialized gdk is just not worth it.
2017-01-19 13:21:12 -05:00
Emmanuele Bassi
b39e537e1c gdk: Skip GdkVulkanContext methods when building introspection data
We cannot use Vulkan types through introspection anyway.
2017-01-19 18:18:07 +00:00
Carlos Garnacho
6beb0b91c9 wayland: Push NULL buffer when hiding a GdkWindow
This is how windows are meant to be hidden as per the wayland
protocol, there's no need to destroy the xdg_surface and other
interfaces.

Also, rename gdk_wayland_window_hide_surface() to clear_surface(),
as that's what it does.

https://bugzilla.gnome.org/show_bug.cgi?id=773686
2017-01-19 16:18:54 +01:00
Benjamin Otte
2ae6f59e7a docs: Remove mention of GdkColor 2017-01-18 04:13:56 +01:00
Rui Matos
7a1b30f16e gdk/wayland: Always get the seat's key modifiers from the GdkKeymap
Elsewhere we already go through the keymap to get modifiers so we
should do the same here. In fact, this was relying on xkb modifier
mask values being bitwise compatible with GdkModifierType which isn't
necessarily true.

https://bugzilla.gnome.org/show_bug.cgi?id=770112
2017-01-17 18:24:28 +01:00
Rui Matos
515b71f14c gdk/wayland: Don't add GDK_META_MASK to gdk mod masks if MOD1 is set
Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to be
mapped around, so we should avoid adding GDK_META_MASK if MOD1 is
already included to avoid confusing gtk+ and applications that rely on
that behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=770112
2017-01-17 18:24:28 +01:00
Jonas Ådahl
7ca6d7585f wayland: Handle subsurface as popup parent
When a subsurface is used as a parent of a popup, GDK needs to traverse
up to the transient-for as the next parent, to properly find the parent
used by the popup positioner. This is because the parent of a popup
must always either be an xdg_popup or an xdg_surface, but traversing
the "parent" (in GDK terms) upwards from a subsurface will end up on
the fake root window before we hit the actual parent (in Wayland terms).

https://bugzilla.gnome.org/show_bug.cgi?id=776225
2017-01-17 09:02:41 +01:00
Mohammed Sadiq
8ffecabd93 wayland: avoid an unnecessary g_list_length call
https://bugzilla.gnome.org/show_bug.cgi?id=777363
2017-01-16 21:42:05 -05:00
Olivier Fourdan
4259aba883 wayland: avoid 0 width/height anchor rectangle
Passing a rectangle with zero width or height to xdg_shell-v6
set_anchor_rect() will cause a protocol error and terminate the client,
as with gedit when pressing the Win key.

Reason for this is because the rectangle used to set the anchor comes
from gtk_text_layout_get_iter_location() which uses the pango layout
width/height, which can be empty if there is not character at the given
location.

Make sure we don't use 0 as width or height as an anchor rectangle to
avoid the protocol error, and compensate the logical position of the
given rectangle if the size is changed, so that the actual position
remains as expected by the client.

https://bugzilla.gnome.org/show_bug.cgi?id=777176
2017-01-16 13:55:51 +01:00
William Hua
670ae58cc9 mir: use modal window hint 2017-01-12 17:24:19 -05:00