Commit Graph

45 Commits

Author SHA1 Message Date
Carlos Garnacho
0d7fe2ec09 gtk: Check implicit grab status before sending crossing events
As we now refrain from sending the crossing events if there's an
implicit grab, those events must be sent on button release when
the implicit grab is broken.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
599344d428 gtkwindow: Add private API to update pointer cursors 2017-05-25 16:25:59 +02:00
Carlos Garnacho
b7fee9f9d2 gtkwindow: Revoke implicit grabs when activating an explicit one
Only if they fall outside the grab widget, in that case the widget holding
the implicit grab won't be receiving events anymore, so we can just undo
it.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
3dfab962fa gtk: Implement per-focus implicit grabs
Unlike GTK+ grabs which are global to all/one device, the implicit grab
is per focus, which means each may have implicit grabs on different or
the same widget.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
8f24df1c19 gtk: Update GtkPointerFocus targets on mapping/sensitivity changes
Those are situations that must cause foci on these widgets to repick
themselves.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
17aa0ca76e gtkwindow: Add management functions for GtkPointerFocus instances
Each toplevel will keep its own tracking of the current ongoing foci,
add the plumbing that will allow to create/update/remove those as they
come and go.
2017-05-25 16:25:58 +02:00
Timm Bäder
cc05fc574c window: Remove _gtk_window_set_is_toplevel
All GtkWindow instances are toplevels.
2017-03-31 09:50:39 +02:00
Timm Bäder
0ce9f26dc5 window: Remove has-toplevel-focus property
Since embedded toplevels don't exist anymore, :has-toplevel-focus is
equivalent to :active.
2017-03-31 09:50:39 +02:00
Emmanuele Bassi
258af60c18 gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-10-18 11:49:06 +01:00
Benjamin Otte
2fd5048943 API: window: Remove suppport for changing wmclass_name/group
X11 was the only backend to support it and people can just override it
using XSetClassHint() directly.
The docs already advertised the function as "Do not use".

Keep the existing call to XSetClassHint() in place, so that we keep
setting the same values as in GTK3.
2016-10-16 18:17:21 +02:00
Matthias Clasen
18aa05110f Put window exporting behind a display protocol agnostic API
Introduce a private API meant for abstracting how to get a handle
of a window that can be shared with other processes. The API is
async, since some implementations will require that. Currently,
only X11 is supported, which doesn't.

Based on a patch by Jonas Adahl.
2016-07-28 13:01:22 -04:00
Carlos Garnacho
fa3e0be80c GtkWindow: make popover stacking explicit
The list of popovers will specify the stacking order, a
_gtk_window_raise_popover() private call has been added so popover
widgets can request being on top.

Also, the stacking on popovers is ensured on gtk_window_size_allocate(),
after the size/stacking changes on the child widget have finished, this
will ensure popovers are kept on top of window contents.

https://bugzilla.gnome.org/show_bug.cgi?id=756670
2015-11-03 07:14:36 -05: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
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
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
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
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
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
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
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
6e96111d9f GtkHeaderBar: try harder to find the best window icon
GtkWindow has 4 (!) APIs for setting window icons, and we
have to try them all in the right order to find the right
icon. This commit makes it so, and keeps the icon list
manipulation inside gtkwindow.c by adding a private API
for getting a single icon at the right size.

https://bugzilla.gnome.org/show_bug.cgi?id=722515
2014-01-24 15:40:37 -05:00
Carlos Garnacho
168227165d window: Make popover window private 2014-01-22 17:10:07 +01:00
Carlos Garnacho
36abb4b829 gtkmain: Let windows handle WM-related events before delivering to the grab_widget
This makes it possible to move/resize client-side decorated windows that are
otherwise obscured by a GTK+ grab somewhere else, either a popover within the
window itself or a modal dialog above the window.
2014-01-22 17:10:05 +01:00
Cosimo Cecchi
197785744b window: add an is-maximized property to GtkWindow
With proper notifications, plus an accessor method for that state. This
allows client to just listen to notify::is-maximized instead of tracking
window-state-event.

https://bugzilla.gnome.org/show_bug.cgi?id=698786
2014-01-13 23:13:37 -05:00
Matthias Clasen
2232430a5a Redo csd window-dragging
The window-dragging code had a number of issues: The code was
starting a drag on every button press, never bothering to cancel
them. This leads to the odd hand cursor occurring between the two
clicks to maximize. We relied on GDK's multi-click detection, which
gives us triple-clicks when we really want sequences of double-clicks.
Lastly, we didn't propery restrict double-click handling to the primary
button, so e.g. if you had a window on an empty workspace, double-right
click on the titlebar would maximize it, which is not intended.

This commit solves all three problem by a doing our own double-click
detection, and only starting a drag when the pointer goes out of
'double-click range'. We change the way dragging is implemented for
menubars and toolbars to just letting events bubble up, so they
get the same behaviour as the titlebar. To make this work, we
have to select for pointer motion events in a few more places.
2014-01-12 22:25:19 -05:00
Jasper St. Pierre
8a1fb19e88 gtkwindow: Rename get_decoration_size => get_shadow_width 2014-01-10 12:10:33 -05:00
Jasper St. Pierre
d9f92424b2 headerbar: Support all kinds of CSD decorations
Move the gtkwindow.c CSD code into GtkHeaderBar, and make it triggerable
by the show-close-button property, and remove shows-fallback-app-menu.

https://bugzilla.gnome.org/show_bug.cgi?id=720233
2013-12-12 19:30:59 -05:00
Matthias Clasen
73b02933d0 GtkWindow: better app menu fallback for CSD
Do the menubutton for app menu fallback ourselves in GtkWindow
for the csd, non-custom titlebar case. This fits better with
the way we handle other title buttons. Themes have control
over the placement of this button by placing menu in the
decoration-button-layout style property.
2013-11-16 14:52:21 -05:00
Matthias Clasen
cadef51b3d GtkWindow: Make titlebar widget available privately
This will be used in GtkApplicationWindow in the
following commits.
2013-11-16 01:39:41 -05:00
Lionel Landwerlin
be5b6460e7 menushell/toolbar/window: implement toggle maximize on double click
https://bugzilla.gnome.org/show_bug.cgi?id=700419
2013-11-09 14:19:47 -05:00
Ryan Lortie
9a6ee36e9c GtkApplication: a new approach to accels
Rework how accels are handled on GtkApplicationWindow.

Instead of having GtkApplication fill the GtkAccelMap which is then used
by GtkApplicationWindow to create a GtkAccelGroup filled with closures
that is then associated with the window, do it directly.

GtkApplication now keeps a list of accels and their actions.
Accelerators on a GtkApplicationWindow ask GtkApplication to execute the
appropriate action.

This saves a fair bit of complexity and memory use (due to not having to
create all those closures and accelmap entries).  The new approach also
supports multiple accels per action (although there is not yet a public
API for it).

This patch (and the ones before) Reviewed and ACK'd by Matthias Clasen.
2013-10-15 09:24:12 -04:00
Matthias Clasen
1507ba79ec csd: Drop content_window
Instead of reparenting the content, use input-only windows to
set cursors and capture clicks on the window frame. This avoids
some of the problems that were introduced by content_window, such
as black flashes and non-working opacity.
2013-04-20 23:37:10 -04:00
Benjamin Otte
33f1210f72 window: Remove an unused function.
Luckily, we don't need to support an implementation of a minimal WM for
linux-fb anymore (which is what this function was added for).
2013-04-09 12:09:12 +02:00
Cosimo Cecchi
58209e1138 window: rename functions dealing with mnemonic delayed display
Don't mention "auto mnemonics", since those methods are purely about
scheduling a delayed display, and that makes understanding the code a
bit harder.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:42 -04:00
Matthias Clasen
93efaa5ebe Fix GtkApplicationWindow menubar placement
Since the menubar is part of the content, we need to give
it the content_window as parent window, to make things
work again.
https://bugzilla.gnome.org/show_bug.cgi?id=696561
2013-03-27 00:23:19 -04:00
Rob Bradford
55a98da4d4 window: Allow _gtk_window_set_allocation to return a modified allocation
Update the documentation and users of this function to handle
the future case that that we have some internal decorations to the window and
useable allocation is thus smaller.

By having a separate out parameter there is no need to have an in/out function
and allows for greater robustness.

The current implementation simply returns the allocation provided.
2013-03-17 11:28:26 -04:00
Rui Matos
ed7a417dcb window: Add a delay before automatically showing mnemonics
Showing mnemonics immediately on modifier press can be annoying and
distracting when the user is just trying to Alt+Tab into another
application/window since the mnemonic will show up and quickly vanish
again when we receive the focus out event.

https://bugzilla.gnome.org/show_bug.cgi?id=672431
2012-08-31 22:53:23 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
681871dd9e GtkApplicationWindow: Fix resize grip positioning
Based on a patch by Carlos Garcia Campos, bug 668248
2012-01-20 01:01:08 -05:00
Benjamin Otte
fac914d70c API: gtk: Remove client_event vfunc from GtkWidget
Also remove the (de-facto unused) implementation from GtkWindow that was
only used for sockets/plugs.
2011-02-01 06:33:01 +01:00
Benjamin Otte
63aa56bcc4 window: Get rid of GdkNativeWindow usage
Make _gtk_window_add_embedded_xid() and
_gtk_window_remove_embedded_xid() take a Window.
2011-01-28 17:06:07 +01:00
Benjamin Otte
e1f6a24da9 window: Make embedded xid specific to the X11 backend 2011-01-28 17:06:07 +01:00
Benjamin Otte
5a1755bc50 gtk: Prefix gtk_window_add_embedded_xid() with underscore
It's a private API after all.
Same thing for gtk_window_remove_embedded_xid().
2011-01-28 17:06:07 +01:00
Matthias Clasen
7b665316cf Hide GtkWindowGroup members
In the process of removing all sealed members from headers.
At the same time, add a gtkwindowprivate.h header and move
all internal functions from gtkwindow.h there.
2010-12-17 20:41:16 -05:00