Commit Graph

62 Commits

Author SHA1 Message Date
Matthias Clasen
9af01bea5e window: Make _gtk_window_set_is_active static
It is not used outside gtkwindow.c.
2019-05-04 18:22:28 +00:00
Matthias Clasen
b804235aea Add a flags argument to gtk_widget_pick
This will be used to let the inspector and other users
pick insensitive widgets again. For now, update all
callers to pass no flags, preserving the current
behavior.
2019-04-07 17:19:09 +00:00
Matthias Clasen
5e24454764 window: Stop implementing pick
Treat popovers as a special-case for now.
2019-04-07 16:11:20 +00:00
Benjamin Otte
694d7c378b root: Move the renderer to the root 2019-02-15 06:53:17 +01:00
Benjamin Otte
2fbdd8b849 root: Add GtkRoot:get_display vfunc
And use it.
2019-02-15 06:53:17 +01:00
Benjamin Otte
e0ec5caaf8 container: Drop gtk_container_check_resize()
Instead, hardcode GtkWindow for now.
The code for non-windows was entirely broken.
2019-02-15 06:53:17 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Matthias Clasen
a7aed5af4b Drop gtk_window_set_use_subsurface
This is no longer used.
2018-08-18 23:24:59 -04:00
Carlos Garnacho
ca08cf94d3 gtkwindow: Move map/delete/configure event management to gtkmain
Toplevels are about the only widgets interested in these events,
just handle those without going through the capture/bubble handling
code.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
3d5dc16d63 gtkwindow: Simplify WM drag/resize handling
We still need a drag gesture both on front (capture) and back (bubble)
to handle dragging from both the GtkWindow widget and chrome in the
headerbar. But we can do it through 2 drag gestures, instead of special
event handling code.
2018-06-21 12:52:59 +02:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Benjamin Otte
70846c85b3 window: Make icons GdkTextures
Cairo surfaces are bad, mkay?
2017-11-05 00:07:17 +01:00
Benjamin Otte
07164e098a window: Turn gtk_window_set_screen() into gtk_window_set_display()
And have a priv->display instead of a priv->screen.

Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
2017-10-31 08:25:37 +01:00
Alexander Larsson
aa873e7709 GtkWindow: Use cairo_surface_t for icons 2017-10-22 22:57:21 +02:00
Timm Bäder
54c362bf48 gtkwindowprivate: Remove _gtk_window_keys_foreach
Unused outside of gtkwindow.c
2017-08-14 14:24:29 +02:00
Timm Bäder
c309def4f0 winodw: Remove _gtk_window_reposition prototype
It's never implemented.
2017-08-14 14:24:10 +02:00
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