Commit Graph

889 Commits

Author SHA1 Message Date
Jasper St. Pierre
6325e4a037 gtkwindow: Force CSD on Wayland
We rely on CSD here on the Wayland platform and giving the opportunity
to turn it off doesn't make too much sense.
2014-06-26 10:32:10 -04:00
Carlos Garnacho
3ef1b387bc window: Only claim a button=1 press sequence when dragging is about to happen
This way plain clicks can be handled in gtkmain through the usual delivery mechanism,
and get possibly handled too by widgets holding a GTK+ grab. If window dragging is to
be started, the sequence will be claimed (and a grab will happen afterwards), notifying
properly the grabbing widget that event delivery was interrupted.

This makes it possible to dismiss popovers by clicking on window headerbars, while
still making it possible to drag the window with the popover opened.
2014-06-12 14:27:35 +02:00
Matthias Clasen
2d05bf1492 csd: Fix non-resizable windows
For csd override-redirect windows, we don't set up resize handles,
but we were not ignoring the margin in all places, causing some
size calculations to go wrong.
2014-06-11 00:04:04 -04:00
Matthias Clasen
bde4e86357 Allow csd for override-redirect windows
This commit makes it possible to use client-side decorations for
override-redirect windows by calling _gtk_window_request_csd()
before realizing the window. Since the wm won't do interactive
resizing for us in this case anyway, don't bother creating
the border windows we use for this purpose on regular toplevels.

To make this accessible to themes, we set a "csd" style class
on client-side decorated windows. With this, .window-frame.csd.menu
can be used to define the shadow for csd menus, and .menu can be
used to define a border for menus under non-composited wms.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:01:42 -04:00
Matthias Clasen
510c2cdfb6 GtkWindow: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:55 -04:00
Matthias Clasen
05cabd3557 GtkWindow: Trivial cleanup 2014-06-09 13:30:55 -04:00
Matthias Clasen
3aa1350bd0 GtkWindow: always input-shape csd windows
Even if we don't have border windows, we need to set the input
shape so we ignore clicks in the shadow region.
2014-06-06 22:07:14 -04:00
Matthias Clasen
7a0642743d Fix up internal function naming
Even if you believe this functionality belongs into gdk, it
is not ok to name internal functions in gtkwindow.c gdk_window...
2014-06-04 06:38:20 -04:00
Matthias Clasen
872fbfacd3 Split GtkWindowGroup into its own file
gtkwindow.c is too big and too messy. This is a small step
towards making it better.
2014-06-04 06:24:05 -04:00
Carlos Garnacho
3c0ebf65cf window: Only check for the event widget if clicked on the "content" region
Every button press/release event reaching the the multipress gesture in GtkWindow
and happening in the "title" region must be handled, regardless of the event widget.
Children there wanting the event(s) for themselves are (and were always) expected
to stop event propagation.

So the only place to check for the event widget's "window-dragging" style property
is the "content" region, which matches the pre-gestures behavior.

This fixes some issues with sequences being mistakenly claimed (and events not
propagated further) on situations it shouldn't.
2014-06-02 18:38:25 +02:00
Carlos Garnacho
00656ed10b window: Handle manually bubbled events
The multipress gesture must react to either direct events on the
GtkWindow (special cased through _gtk_widget_check_handle_wm_event),
or bubbled events from child widgets. Ensure bubbled events go
through the gesture, those are fed manually to make sure events are
only handled once, in either one or other place. The implicit grab
will ensure that doesn't change mid-action.
2014-06-02 18:38:25 +02:00
Carlos Garnacho
7f33706c12 window: Refactor _gtk_window_check_handle_wm_event()
Separate the event widget check from event handling
2014-06-02 18:38:25 +02:00
Carlos Garnacho
d9bdb9a137 window: Do not raise border windows on each size allocation
This prevents these windows from being raised above popovers, which
is about the only child widget that may overlap with those anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=730589
2014-05-27 17:56:59 +02:00
Carlos Garnacho
a8e833dc5c window: Avoid double event processing in the multipress event controller
The events to those are fed outside the regular event propagation scheme,
through _gtk_window_check_handle_wm_event(), so set the controller to
GTK_PHASE_NONE so events aren't processed first manually, and then
automatically.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
d05a9f9a7b gesture: Replace gtk_gesture_attach/detach with event controller API
Event controllers now auto-attach, and the GtkCapturePhase only determines
when are events dispatched, but all controllers are managed by the widget wrt
grabs.

All callers have been updated.
2014-05-27 17:47:12 +02:00
Matthias Clasen
6896c979a9 GtkWindow: Only use a multipress gesture for toplevels
There is no point in creating and attaching this gesture
for override-redirect windows, so don't do it.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
5369c77029 gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.

The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.

All callers have been updated.
2014-05-23 19:54:29 +02:00
Matthias Clasen
c6c41262b6 GtkWindow: Don't leak the gesture 2014-05-23 19:54:28 +02:00
Carlos Garnacho
ff627511b7 window: update to gesture widget-level API changes 2014-05-23 19:54:26 +02:00
Carlos Garnacho
61e88c251e window: Use gestures for window moving/resizing
A multipress gesture is used to control all this, replacing
single/double click custom code, and triggering window dragging
when the multipress is stopped, yet active (ie. the sequence remains
pressed).
2014-05-23 19:54:24 +02:00
Matthias Clasen
2df80d7a4d inspector: Repeat the keybinding warning
Show the confirmation dialog every time the keybinding is used,
until the user clicks OK.
2014-05-22 18:37:43 -04:00
Jasper St. Pierre
0ea1a526f9 gtkwindow: Use window-manager-side window menus
This avoids a bunch of policy problems with deciding how to lay
out the window menu under different WMs.

For now, we use the special event _GTK_SHOW_WINDOW_MENU, but we
hope to have this standardized in wm-spec quite soon, as KDE wants
it as well.
2014-05-21 18:41:07 -04:00
Piotr Drąg
df61db6dbc Improve punctuation in a new translatable string 2014-05-17 20:20:45 +02:00
Matthias Clasen
b4a57a0f0c inspector: Add a first-time warning
With the keybinding, it is possible that users may trigger the
inspector unintentionally. Show a dialog that informs them about
whats going on and gives them a chance to back out.

The warning dialog can be bypassed with the
org.gtk.Settings.Debug inspector-warning setting.
2014-05-16 21:51:42 -04:00
Matthias Clasen
298f76e6a3 Docs: Update an example to use current API 2014-05-16 08:25:20 -04:00
Matthias Clasen
59c9d24bbf inspector: stop being a module
Moving the inspector into libgtk lets use reuse internals without
having to add public API for everything or inventing awkward private
call conventions.

https://bugzilla.gnome.org/show_bug.cgi?id=730095
2014-05-14 21:23:44 -04:00
Matthias Clasen
069a2603ef inspector: Add a setting to disable the keybinding
This will be needed for lockdown, e.g. on the login screen.
https://bugzilla.gnome.org/show_bug.cgi?id=730007
2014-05-13 15:20:36 -04:00
Matthias Clasen
b8531087bd inspector: All to turn it on programmatically
Export gtk_window_set_interactive_debugging.
https://bugzilla.gnome.org/show_bug.cgi?id=730008
2014-05-13 15:20:36 -04:00
Matthias Clasen
63288829b0 Add an alternative keybinding for the inspector
Control-Shift-I is already used for similar things in many
applications, so provide Control-Shift-D as an alternative.
https://bugzilla.gnome.org/show_bug.cgi?id=730043
2014-05-13 11:04:43 -04:00
Matthias Clasen
7a56404e7b Make the inspector available via GTK_DEBUG
Change things around so GTK_DEBUG=interactive also brings
up the inspector window.
2014-05-10 22:04:36 -04:00
Matthias Clasen
ccff3e952d Rename parasite to gtkinspector
This avoids namespace collisions with the original
gtkparasite project, and adds the gtk prefix to
all symbols and type names.
2014-05-10 22:04:20 -04:00
Matthias Clasen
19bf88acfa Add a 'toggle-debugging' keybinding
This is bound to Ctrl-Shift-I (for inspector) by default.
It loads the gtkparasite module and opens a parasite window.
2014-05-10 22:04:19 -04:00
Matthias Clasen
f5e64936da GtkWindow: small cleanup
The window type is a construct-only property, so we should
pass it to g_object_new, not set it after the fact in the
constructor.
2014-05-09 17:13:53 -04:00
Benjamin Otte
8b15cd33ee window: Subtract shadow from passed in width for height
... and height for width in size requests. Fixes mislayout in
control-center universal access panel.
2014-04-29 19:36:26 +02:00
Matthias Clasen
063bd57873 GtkWindow: Avoid a critical in F10 handling
The focus widget might be NULL, and we were forgetting to take
that possibility into account in one place.
2014-04-25 22:12:05 -04:00
Matthias Clasen
2d7b9273cf window: Be more careful when propagating key events
We are keeping references on the widget we are handling as we
are iterating up, but that doesn't protect us against the entire
tree being axed from inside gtk_widget_handle_event.
https://bugzilla.gnome.org/show_bug.cgi?id=727644
2014-04-11 22:00:01 -07:00
Руслан Ижбулатов
fee41fb616 Revert "W32: Implement composition check for GDK"
This reverts commit 7ae5a56948.

Pushed by accident.
2014-04-10 17:58:58 +00:00
Руслан Ижбулатов
7ae5a56948 W32: Implement composition check for GDK
Also move DWM function grabbing and make those functions available to all of GDK-Win32.

https://bugzilla.gnome.org/show_bug.cgi?id=727316
2014-04-10 17:49:20 +00:00
Matthias Clasen
fb9a6bb6d8 csd: Drop the GTK_FRAME_EXTENTS requirement
We are getting bug reports from people who are irritated that
dialogs now have 'double headers' under any wm but gnome-shell.

As an example, xfwm4 seems to do ok with csd windows, and
on balance it seems better to have some invisible border issues
than to have double headers.

https://bugzilla.gnome.org/show_bug.cgi?id=727414
2014-04-04 01:28:09 -04:00
Sébastien Wilmet
1bf2e0600f doc: fix gtk_window_destroy() -> gtk_widget_destroy()
Reviewed-by: Emmanuele Bassi
2014-04-03 18:28:10 +02:00
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
Johannes Wellhöfer
46cfebfe97 Also revert enable-mnemonics code in gtkwindow, which was forgotten in commit 34cf40e95c.
https://bugzilla.gnome.org/show_bug.cgi?id=708346
2014-03-24 20:17:20 -04:00
Matthias Clasen
9ed2c8a719 Fix undecorated windows
Setting windows undecorated was broken by some of the recent
shadow width changes. We need to ensure that shadow width is
zero for undecorated windows, then things work again.
2014-03-21 15:39:46 -04:00
Carlos Garnacho
9adfc8e2c4 window: Unset source ID before possibly destroying the widget
If the delete event ends up destroying the widget, unsetting
priv->delete_event_handler will happen on invalid memory, so
unset it before the widget is possibly destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=726825
2014-03-21 15:41:10 +01:00
Matthias Clasen
6fbe287622 csd: Fix the northeast resize handle position 2014-03-12 00:28:26 -04:00
Matthias Clasen
5b341e8e6e csd: Fix invisible border/shadow confusion
We did not set an input shape on the window, so the region outside
the invisible border where we draw the outer edges of the shadow
were still part of the window, as far as clicks and cursors were
concerned. Fix this by setting an input shape that makes all clicks
outside of the resize borders go through to the underlying window.

https://bugzilla.gnome.org/show_bug.cgi?id=726125
2014-03-12 00:18:04 -04:00
Carlos Garnacho
168e4faf50 window: Emit a11y signals directly on popover added/removed
As those are internal children, there's no signal that GtkWindowAccessible
could catch when those are added or removed, so make GtkWindow use the private
GtkContainerAccessible methods to add/remove the child accessible when that
happens.

https://bugzilla.gnome.org/show_bug.cgi?id=725864
2014-03-10 23:02:06 +01:00
Phillip Wood
beaba95f39 Window: Focus custom titlebar with F10
As discussed on desktop-devel-list [1], "There should be an intuitive,
consistent, immediate way to jump to the widgets that live in the
header bar." F10 has been suggested for this as it is already used to
active menubars.

F10 will focus the custom titlebar widget if the window has one and it
isn't already focused. If the titlebar widget doesn't exist or is
already focused then F10 focuses the menubar if there is one.

[1] https://mail.gnome.org/archives/desktop-devel-list/2014-February/msg00176.html

https://bugzilla.gnome.org/show_bug.cgi?id=725141
2014-03-09 20:26:54 -04:00
Carlos Garnacho
59a928f7c8 window: Turn popovers into internal children
It turns out popovers are already smart enough to cope with this
situation, so let popovers be internal children so things that rely
on gtk_container_forall(), like DnD, work without modifications.

https://bugzilla.gnome.org/show_bug.cgi?id=725727
2014-03-06 23:21:43 -05:00
Matthias Clasen
db9a6f8caf Some more doc rewording 2014-03-03 18:13:24 -05:00