Commit Graph

1027 Commits

Author SHA1 Message Date
Timm Bäder
02306867c3 GtkWindow: Check for popover realized-ness before unrealizing
https://bugzilla.gnome.org/show_bug.cgi?id=755473
2015-09-23 23:26:44 -04:00
Carlos Garnacho
e3d21accd0 window: cancel unclaimed sequences after GtkEventController::handle_event.
To GtkGesture machinery, if an event triggers a controller/gesture signal,
and gesture reset/cancellation as a result, the event has been managed
after all.

Commit e3bd895667 effectively changed the return value of the
wrapping gtk_event_controller_handle_event() function, which broke some
paths (eg. gtk_popover_button_press() wouldn't while the GTK+ grab was
active for this reason because the button press event was consumed early
on gtk_window_check_handle_wm_event()).

That patch is not too off-track given potential child widgets' behavior,
we want nonetheless to distinguish the denied vs cancelled paths here
(because GtkWindow itself relies on the GtkGesture behavior described in
the first paragraph on the begin_move/resize paths), so just reset
gestures after the event has already gone through the GtkEventController
so the return value is unaffected.
2015-09-21 14:32:44 +02:00
Carlos Garnacho
e3bd895667 window: Reset on unhandled gestures right away
Traditionally a sequence is set to GTK_EVENT_SEQUENCE_DENIED state when
it is to be ignored, which means it is dormant, but still managed by the
gesture (accounting, "denied" sequences still make "slots" in multitouch
gesture busy, etc...).

This gesture will run for all button presses and releases in the window
though when presses happen on the "window content" region, and we can't
account for every children to be as educated as setting the proper mask
on every window, or ensuring events will be propagated as they should.

In order to cater for this, just reset the gestures, we can live without
such accounting in these specific GtkGestureSingle gestures.

https://bugzilla.gnome.org/show_bug.cgi?id=754098
2015-09-18 12:51:22 +02:00
Benjamin Otte
07a574dddd window: Use gtk_widget_queue_resize()
_gtk_container_queue_resize() is a private function and probably
shouldn't have even been used in 1999 when this call was originally
added.
2015-09-14 23:36:58 +02:00
Benjamin Otte
51a1bc21af Revert "Avoid type checking overhead for resize-mode"
This reverts commit 3eacfa88f2.

Apart from the patch not being correct, we don't want to expose private
structures in header files if we can avoid it.
And this type-checking overhead is not an optimization that is even
measurable.

https://bugzilla.gnome.org/show_bug.cgi?id=754932
2015-09-12 21:27:24 +02:00
Matthias Clasen
3eacfa88f2 Avoid type checking overhead for resize-mode 2015-09-12 12:50:38 -04:00
Matthias Clasen
95cf550e15 window: Avoid unnecessary detours
Don't call gtk_widget_get_screen on a window - it only ends up
calling gtk_window_get_screen in the end, anyway.
2015-09-12 12:50:38 -04:00
Matthias Clasen
0368cbd256 window: Use internal more internal getters 2015-09-08 08:07:33 -04:00
Matthias Clasen
15b9feda22 widget: Add more inline getters
Add a getter for state flags, and use it where appropriate.
2015-09-07 12:23:09 -04:00
Matthias Clasen
0f92a43e10 Move GtkWidgetPrivate to gtkwidgetprivate.h
This lets us use inlined getters for members in there,
avoiding the type checks in the public getters.
2015-09-07 02:40:22 -04:00
Matthias Clasen
f3d92735ac window: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:34 -04:00
Benjamin Otte
5037d134c5 window: Only update the inspector once
Instead of queueing a new idle handler every time we call
gtk_window_update_debugging(), only queue one if none is queued that.

Saves a lot of work, in particular when templates create context menus
for every row in a large listbox as in the gtk-demo listbox example.
2015-08-26 15:46:07 +02:00
Matthias Clasen
0455e56517 window: Set name on idle
Use gdk_threads_add_idle, and set a name on the source to aid
debugging, as we do everywhere else.
2015-08-15 16:05:11 -04:00
Matthias Clasen
a6b52c4275 Revert "Revert "Revert "gtkwindow: Reset maximize / fullscreen_initially on state changes"""
This reverts commit 8001b2c1b3.
2015-08-12 19:35:52 -04:00
Matthias Clasen
5cea77de38 Revert "Revert "Revert "window: fix initial shadow width for maximized/fullscreen windows"""
This reverts commit 968ac90e89.
2015-08-12 19:35:10 -04:00
Matthias Clasen
8001b2c1b3 Revert "Revert "gtkwindow: Reset maximize / fullscreen_initially on state changes""
This reverts commit de2ea1ebaa.

No reason in the commit message was given for the revert, and we need
this for proper behavior on map.
2015-08-12 14:40:31 -07:00
Jasper St. Pierre
968ac90e89 Revert "Revert "window: fix initial shadow width for maximized/fullscreen windows""
This reverts commit 8b695cc727.

No reason in the commit message was given for the revert, and we need
this for proper behavior on map.
2015-08-12 14:40:20 -07:00
Carlos Garnacho
69c9cb85e2 gtkwindow: bail out on WM operations in the presence of grabs
These operations will require a grab on the WM side, so we can spare the
attempt from the WM to take a grab when we're certain it won't suceed.

https://bugzilla.gnome.org/show_bug.cgi?id=752327
2015-08-04 17:59:01 +02:00
Matthias Clasen
859db92183 Remove a redundant assignment 2015-07-27 08:07:27 -04:00
Matthias Clasen
b2b4a3bb0a Fix a warning 2015-07-26 01:49:19 -04:00
Matthias Clasen
5c2759af3c Use standard cursor names
This changes GTK+ to use gdk_cursor_new_from_name() with the
'standard' css names, instead of GdkCursorType.

https://bugzilla.gnome.org/show_bug.cgi?id=652085
2015-07-26 01:45:06 -04:00
Jeremy Whiting
f9d903995d Added api to set a window to fullscreen on a given monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=752677
2015-07-25 07:08:59 -06:00
Matthias Clasen
3fec234c22 inspector: Rescan toplevels when they change
This ensures that windows appear in the inspectors tree when
they are created, and it prevents GTK_DEBUG=interactive from
coming up with an empty object tree.

https://bugzilla.gnome.org/show_bug.cgi?id=752664
2015-07-23 21:28:28 -04:00
Matthias Clasen
1138d4f489 Another fix for unmapped window states
The previous fix was falling into the crack between
realized and mapped - we would apply the state when a window
is just realized, then unset the _initially flag, and then
when the window gets mapped, we'd undo the state. To fix
this, go back to the way things were when these flags were
first introduced.

https://bugzilla.gnome.org/show_bug.cgi?id=752765
2015-07-23 17:54:50 -04:00
Matthias Clasen
f30637bbae GtkWindow: Rework the _initially variables
Go back to use these variables only for pre-mapped state changes.
Their use got muddied over the years, and it was hard to keep track
of what is acutal state, and what just a queued request.
2015-07-22 23:28:39 -04:00
Matthias Clasen
8b695cc727 Revert "window: fix initial shadow width for maximized/fullscreen windows"
This reverts commit 740bcf5fe0.
2015-07-22 23:16:52 -04:00
Matthias Clasen
de2ea1ebaa Revert "gtkwindow: Reset maximize / fullscreen_initially on state changes"
This reverts commit 862e0dab03.
2015-07-22 23:16:44 -04:00
Benjamin Otte
04883e72fa window: Set the type hint when it changes, not just on map()
There is no reason to wait until map() to reset a type hint on the GDK
window. Just set it when it changes.
2015-07-19 04:45:25 +02:00
Benjamin Otte
b0ac837271 window: g_object_notify() on type-hint change 2015-07-19 04:45:25 +02:00
Benjamin Otte
38a07cde75 window: Don't update type hint when it didn't change 2015-07-19 04:45:25 +02:00
Benjamin Otte
7a16039c2d window: Allow setting type hint on mapped windows 2015-07-19 04:45:25 +02:00
Benjamin Otte
8a238c7886 window: Don't keep 2 type hints
1. This confuses the code as it's using the old type hint with the new
type hint on GDK window creation

2. It only existed as a workaround for old code that directly accessed
window->type_hint which hasn't been possible since 3.0.
2015-07-19 04:45:25 +02:00
Matthias Clasen
0bb2567ff5 GtkWindow: Fix a use-after-free
We were printing a string in a warning after freeing it.
Also, fix an x/y typo that might cause popovers to be
mispositioned.
2015-07-17 19:19:24 -04:00
Carlos Garnacho
7f57f63eba gtkwindow: Only allow unrestricted positioning to text handle popovers
This behavior has been made optional on add_popover() time, text handles
will keep being able to overflow the window, in order to allow text
selection on views too close to the window edge.

Regular GtkPopovers are reinstaurated to the previous size positioning
logic though, that is, limited by the visible area of the window.
2015-07-06 16:39:06 +02:00
Olivier Fourdan
c806f9b709 ignore size inc when maximized/fullscreen
Under Wayland, fullscreen/maximized windows may not cover the entire
area when a size increment is specified.

Ignore size increments for fullscreen/maximized windows just like most
window managers do under X11 so that windows with size increments can
still be fullscreen or fully maximized under Wayland as well.

https://bugzilla.gnome.org/show_bug.cgi?id=751368
2015-07-03 16:21:13 +02:00
Jasper St. Pierre
862e0dab03 gtkwindow: Reset maximize / fullscreen_initially on state changes
Since 740bcf5, we use these properties to properly compute shadow widths
for unmapped windows. If a client calls gtk_window_maximize and a window
manager unmaximizes a window, we should draw borders, so we need to
reset these when we get the property notification.
2015-07-01 17:50:23 -07:00
Cosimo Cecchi
e67b4874eb window: don't override background every style_updated()
This queues an unnecessary resize on the toplevel, and is not needed
anymore, now that GtkWidget does not call
gtk_style_context_set_background() on the window's GdkWindow anymore.
2015-07-01 16:09:23 -07:00
Cosimo Cecchi
74f2d9448f window: don't call gtk_style_context_set_background() 2015-07-01 16:09:23 -07:00
Christoph Reiter
5d17b0af54 GtkWindow: don't increase the preferred size for empty windows if there is a size request set.
This fixes a reftest broken by commit 84e99b20ac

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-07-01 09:32:19 -07:00
Jasper St. Pierre
04e727709d window: Don't send startup notifications for offscreen / popup windows
The WM isn't aware of O-R (popup) or offscreen windows. If somebody
maps an offscreen or a popup GTK+ window before the main window, we'll
complete the sequence before a "real" window is mapped. Make sure to
ignore these for startup notifies.
2015-06-29 14:26:45 -07:00
Christoph Reiter
48ea0cbe4b GtkWindow: some min/nat size corrections.
Don't add the container border to the title request size; it
is only used for the child widget.

Don't call gtk_widget_get_preferred_width_for_height() for
the title bar with an unrelated height and subtract the title
bar height before querying the child widget width.

Guard against negative size requests after substracting the
borders/shadows and the title bar.

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-06-24 10:58:30 +02:00
Christoph Reiter
84e99b20ac GtkWindow: fix default empty window size with CSD
In the non-CSD case we checked for 0x0 window size requisition
and replaced it with 200x200 so the window was still visible.
This no longer works in case of CSD as the shadow and title bar
are always added to the requisition resulting in a titlebar/shadow
only window in case there is no child widget (this is currently
visible under wayland or when setting GTK_CSD=1).

Instead of special casing the final window size, special case
the child requisition paths instead. This gives us the same
requisition in both, CSD and non-CSD cases (the header bar
has a too large minimum width atm so the resulting window is
still not the same)

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-06-23 21:16:14 +02:00
Christoph Reiter
3c9cca596f Fix calculation of edge input window size in case the real window is too small.
This error resulted in warnings like
"pixman_region32_init_rect: Invalid rectangle passed"

In case the window is smaller than handle_size * 2 the resulting
edge window got a negative size. Prevent that by limiting the
handle size to half the respective edge length. This also
prevents the corner windows from overlapping in case the window
is too small.
2015-06-22 14:22:50 +01:00
Emmanuele Bassi
97e728580c Revert "window: Check if we can use CSD before enabling them"
This reverts commit c5e5ee6749.

It turns out that this commit breaks the default sizing of GtkWindow,
which in turn causes the window to be smaller than the handle size,
which ends up sending invalid rectangles to Cairo.

We'll have to find another way to fix the CSD issue.

See also: https://bugzilla.gnome.org/show_bug.cgi?id=751140

https://bugzilla.gnome.org/show_bug.cgi?id=750343
2015-06-22 14:21:47 +01:00
Emmanuele Bassi
9590879e2f Revert "window: Reinstate logic for should_use_csd()"
This reverts commit f043fd532d.

The whole point of having can_use_csd() return TRUE when GTK_CSD is
unset is to use it inside enable_csd().

https://bugzilla.gnome.org/show_bug.cgi?id=751140
2015-06-18 16:10:36 +01:00
Emmanuele Bassi
f043fd532d window: Reinstate logic for should_use_csd()
The old should_use_csd() function would return FALSE if the GTK_CSD
environment variable is unset; the change in commit c5e5ee6749
made it return TRUE if GTK_CSD is unset. This has a cascade effect
on the window size, which causes invalid rectangles to bubble down
to Pixman.

https://bugzilla.gnome.org/show_bug.cgi?id=751140
2015-06-18 14:52:17 +01:00
Ting-Wei Lan
f85db624eb Fix return value error in _gtk_window_get_popover_parent 2015-06-18 12:14:44 +08:00
Carlos Garnacho
76dc8aced5 window: Add concept of popover "parent"
This will be the widget that the popover relates to (::pointing-to in
GtkPopover, ::parent in GtkTextHandle).

Additional API to check the popover/parent relationship between widgets
has been added, which will be useful wherever this is necessary in a
generic manner.

https://bugzilla.gnome.org/show_bug.cgi?id=750993
2015-06-17 15:56:42 +02:00
Carlos Garnacho
a0ff35f032 window: Avoid rising the window of already shown popovers
This breaks stacking, as popovers are repositioned sort of frequently
(even more after show/hide animations).

https://bugzilla.gnome.org/show_bug.cgi?id=750741
2015-06-12 21:00:45 +02:00
Carlos Garnacho
551931c1c6 window: Allow more space at edges for popovers
We're clamping to the visible window edge, which misplaces text handles.
2015-06-11 17:14:23 +02:00