Commit Graph

915 Commits

Author SHA1 Message Date
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
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