Commit Graph

925 Commits

Author SHA1 Message Date
Matthias Clasen
92e52fd188 Add a style class to fullscreened windows
This will let us tweak stuff that gets shown in fullscreen windows,
https://bugzilla.gnome.org/show_bug.cgi?id=654051
2014-09-26 18:08:46 -04:00
Matthias Clasen
2cb31edf6f inspector: Show the warning dialog without delay
The delay was a mistaken attempt to work around a problem that
is now better understood, see
https://bugzilla.gnome.org/show_bug.cgi?id=735338
2014-09-26 09:50:33 -04:00
Matthias Clasen
3b62f2f01d GtkWindow: improve the inspector keybinding
Binding signals can return a boolean indicating whether they
handled the event. Use that here and return FALSE if the
inspector keybinding is disabled.
2014-09-26 09:50:33 -04:00
Matthias Clasen
fcec9b9812 Use titlebar action settings for CSD windows
Instead of hardcoding these actions, consult the settings.
Note that not all of the actions supported by gnome-shell are
implemented here, only maximize, minimize, lower, and menu.

https://bugzilla.gnome.org/show_bug.cgi?id=729782
2014-09-25 14:54:49 -04:00
Matthias Clasen
d20fdd18eb Factor out titlebar click actions
So they can be made configurable.

https://bugzilla.gnome.org/show_bug.cgi?id=729782
2014-09-25 14:54:49 -04:00
Carlos Garnacho
6b7b55f9b2 gtkwindow: run ::event and specific handlers for EWMH action triggering events
This gives an opportunity for implementations to handle these events
differently, instead of hardcoding the WM-triggering behavior.

gtk_window_event() only forwards events for WM management if the event
widget is not the window (ie. caught when bubbling), so is safe to be
called here without triggering gtk_window_handle_wm_event() twice.

This commit is an adaption to master of
https://bugzilla.gnome.org/show_bug.cgi?id=736702#c1 by Cosimo Cecchi.
2014-09-22 20:51:24 -04:00
Matthias Clasen
3c96ea0ae7 inspector: Look up the schema recursively
This is the recommended way to use this function. It should
also fix problems with the inspector when GSETTINGS_SCHEMA_DIR
is set.

https://bugzilla.gnome.org/show_bug.cgi?id=737027
2014-09-20 19:52:23 -04:00
Jasper St. Pierre
df236fba58 gtkwindow: Make sure to update the shadow width, opaque region and border windows when realizing
Otherwise, they might not be properly set before the window is mapped.

For the opaque region and border window, it means that they won't get
set before the next size allocation, which tends to not be a bit deal.

For the shadow width, though, _GTK_FRAME_EXTENTS has a different meaning
when it's set before the window is mapped, so we need to make sure that
it's properly set when the window is mapped.
2014-09-19 17:39:46 -06:00
Matthias Clasen
a1af365566 Don't forget to allocate popovers
When GtkApplicationWindow has a menubar, we don't chain up
to the GtkWindow size_allocate, which used to position the
popovers. Move that to _gtk_window_set_allocation() which
is always called by GtkApplicationWindow.

https://bugzilla.gnome.org/show_bug.cgi?id=736205
2014-09-06 21:32:53 -04:00
Matthias Clasen
84ff0c201a Don't set an input shape unless client-decorated
We were actually setting an input shape larger than the window
in !csd, and this was confusing at least openbox.

https://bugzilla.gnome.org/736064
2014-09-06 15:43:11 -04:00
Carlos Garnacho
ee93db1659 window: Add private API to hardcode the main GdkWindow for a GtkWindow
This must be called while the window is not realized yet, and sets the
GdkWindow that will be used for the next GtkWindow's realize/unrealize
cycle. The GtkWindow takes ownership on the GdkWindow, and as such it
will be destroyed when the widget is unrealized.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:54 +02:00
Carlos Garnacho
c38651cac4 gtkwindow: Add private API to mark as subsurface
This is a rather hackish way to let GTK+ widgets declare popup windows
as subsurfaces, so they may work on wayland without the need of xdg_popup,
and without many changes yet on the GTK+ side.

https://bugzilla.gnome.org/show_bug.cgi?id=695504
2014-08-26 23:06:01 +02:00
Carlos Garnacho
c17d3ee8fe window: Set GtkGestureSingle::button to 0 on multipress gesture
This gesture handles events from multiple buttons, so ensure the
gesture still does so after the default value change.

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:53:40 +02:00
Carlos Garnacho
131123c71a window: Set multipress gesture phase to be GTK_PHASE_NONE explicitly
This used to rely on the default value, which has changed to a saner default.

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:49:39 +02:00
Carlos Garnacho
5b8267028d window: Update popover positions on ::size-allocate
Popovers may get relocations optimized away if only x/y changed
in the GtkAllocation. So make sure the toplevel updates popover
positions on all situations.

https://bugzilla.gnome.org/show_bug.cgi?id=729140
2014-08-03 18:37:53 +02:00
Carlos Garnacho
25721ae3e7 window: Only avoid queueing resizes if the popover position didn't change
If the same position is requested on a popover, it should at least ensure
the window is realized and raised, even if no resizes are queued on the
content. Otherwise other widgets being mapped might raise the windows over
the popover's if its original position is unchanged.

https://bugzilla.gnome.org/show_bug.cgi?id=734129
2014-08-03 01:12:12 +02:00
Matthias Clasen
785c9f5e2c Remove a reference to a non-existing function 2014-08-02 22:26:05 +02:00
Matthias Clasen
14eccae603 GtkWindow: Add a way to declare initial focus in ui files
With this commit, it is possible to use <initial-focus name="blah">
to declare the initial focus widget for a window.

This is related to
https://bugzilla.gnome.org/show_bug.cgi?id=734033
2014-08-02 11:58:13 +02:00
Matthias Clasen
f15ebc2dd2 GtkWindow: Make set_focus work before show
So far, gtk_window_set_focus just did not work when called on
a hidden window. Change it to record the desired focus widget
for hidden windows, and apply it when the window gets shown.

This is similar to how we tread other window properties that
can't be set before the window is realized, like maximized
or fullscreen.

This is related to
https://bugzilla.gnome.org/show_bug.cgi?id=734033
2014-08-02 11:38:23 +02:00
Jasper St. Pierre
a3c12ffccb gtkwindow: Clean up gtk_window_move_resize a bit more
Don't shadow existing variables. Instead of sharing the allocation and
then overwriting the width/height when convenient, declare it in the
block we use it in, as, really, the three different paths are all
extremely different, and there's no sense in sharing the variable.
2014-07-17 13:10:50 -04:00
Jasper St. Pierre
927b5a592f gtkwindow: Remove a bogus comment
gtk_window_configure_event certainly doesn't fill the new allocation
in. We're filling it in right here!
2014-07-17 13:10:50 -04:00
Jasper St. Pierre
2e4018c386 gtkwindow: Clean up the code for an optimization
It's hard to figure out what the "expected_reply" means except under
close examination -- it's actually talking about whether this was a
reply to a ConfigureRequest or not. The inversion in the check doesn't
help either.

Make the code cleaner by moving it above the freeze/thaw case, and
making the check more explicit and without a confusing variable. If we
haven't sent any ConfigureRequests out, then it must be a gratuitous
ConfigureNotify.
2014-07-15 14:49:16 -04:00
Jasper St. Pierre
b7a8bde895 gtkwindow: Fix the comment for an optimization
The optimization was incorrect, and so it was changed in commit
2bf6824, but the comment to go along with it was never updated.
2014-07-15 14:49:16 -04:00
Jasper St. Pierre
1fb2756b99 gtkwindow: Remove the unused GTK_WINDOW_REGION_EDGE 2014-07-07 16:30:51 -04:00
Matthias Clasen
a19bc50f64 GtkWindow: Elaborate the keybindings
Keep Ctrol-Shift-D as a straight toggle-the-inspector keybinding,
but make Ctrl-Shift-I always bring up the inspector, and point
it at the widget under the pointer.
2014-07-06 22:37:57 -04:00
Matthias Clasen
b5958d677f GtkWindow: Update default for has-default-grip
It is now FALSE.
2014-07-03 15:23:34 -04:00
Jasper St. Pierre
ece9ae4bc5 gtkwindow: Remove resize grips
Resize grips were introduced for GNOME 3.0, before we had any of the
"new GNOME app" features like invisible borders and CSD. With OS X 10.6
and 10.7, Apple has replaced the classic grips in their applications
with invisible borders as well.

New GNOME app designs don't use resize grips anymore and the new
default theme for GTK+, Adwaita, disables them entirely by forcing their
width and height to 0.

They're past their time. Remove the code to support them. This can
always be reverted if some app relies on them.
2014-07-03 12:58:41 -04:00
Jasper St. Pierre
ed273e7518 gtkwindow: Fix compile warnings 2014-07-03 10:55:31 -04:00
Matthias Clasen
b369719bcd inspector: Handle the dialog more carefully
When showing and hiding the inspector window repeatedly without
dismissing the dialog, we were hiding the inspector, but not
the dialog, leading to a confusing user experience.

https://bugzilla.gnome.org/show_bug.cgi?id=732443
2014-07-02 22:52:10 -04:00
Jasper St. Pierre
796dc682bc gtkwindow: Refactor out some similar code for grips 2014-06-27 09:19:50 -04:00
Jasper St. Pierre
1210b693a0 gtkwindow: Merge some similar code 2014-06-27 09:19:49 -04:00
Jasper St. Pierre
95cb816666 gtkwindow: Remove a dead chain-up
GtkWidget / GtkBin don't have configure-event handlers, so we don't need
to attempt to chain up to them.
2014-06-27 09:19:49 -04:00
Jasper St. Pierre
9c37b3de74 gtk: Don't use GObjectClass.constructor
Use the newer constructed instead, which has a fast path in GObject.
2014-06-26 19:06:43 -04:00
Jasper St. Pierre
75e770bc50 gtkwindow: Remove a dumb invalidate_rect from our configure_event
We shouldn't invalidate the entire window when we receive a
ConfigureNotify. That's just broken.
2014-06-26 15:58:45 -04:00
Jasper St. Pierre
46e7f7f456 gtkwindow: Remove a vestigal line of painting for OR windows
Since we have a paint clock, we shouldn't be sending out EXPOSE events
for OR windows inside the ALLOCATE cycle. The idea here was that we
would have to wait for a map to get an OR window to paint to, but since
then this has been abstracted away inside GDK and the paint clock.
2014-06-26 15:58:45 -04:00
Jasper St. Pierre
35f618e71d gtkwindow: Remove an unnecessary set of grip setting
We already update the grip position in _gtk_window_set_allocation, which
is done through the size_allocate above. Receiving a ConfigureNotify
also won't ever change a grip's visibility, so there's no point in
refreshing it.
2014-06-26 15:58:45 -04:00
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