Commit Graph

1115 Commits

Author SHA1 Message Date
Matthias Clasen
952d0fd23f window: Stop using gdk_screen_get_n_monitors 2016-04-27 23:18:16 -04:00
Matthias Clasen
f5d6688d3e window: Stop using screen width/height 2016-04-27 23:18:16 -04:00
Matthias Clasen
b5fb9ae3b7 gtk: Port to new monitor api
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Sébastien Wilmet
554de0be2a app: replace private accels functions by get_application_accels()
It's like gtk_application_get_action_muxer().

https://bugzilla.gnome.org/show_bug.cgi?id=764879
2016-04-22 12:43:27 +02:00
Carlos Garnacho
46cdb44fdd GtkWindow: Ensure the toplevel is realized before realizing popovers
Otherwise those get a NULL parent window, which is toplevel-y enough
to disembody the popover.

https://bugzilla.gnome.org/show_bug.cgi?id=764060
2016-04-14 11:39:48 +02:00
Sébastien Wilmet
b3dc473057 docs: trivial fixes in GtkApplication-related documentation 2016-04-09 09:45:33 +02:00
Olivier Fourdan
83e775147f wayland: do not update shadows for child windows
glade-previewer places a gtkwindow inside another toplevel gtkwindow,
updating the shadow width for the client induces a busy loop where the
parent will grow continuously until it crashes gnome-shell/mutter.

To avoid the loop, do not update the shadow width if not dealing with a
toplevel window.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=761651
2016-04-08 16:59:36 +02:00
Rui Matos
4bfa6c30bf gtkwindow: Don't allow unresizable windows to be smaller than required
Commit cdc580463e made it so that
unresizable windows can't be smaller than a set default size but it
lost the logic to ensure these windows remain at least big enough to
comply with their requisition.

https://bugzilla.gnome.org/show_bug.cgi?id=764174
2016-04-01 15:30:03 +02:00
Debarshi Ray
fd143a2b38 window: Make the sample code obey the party line on geometry widgets
The geometry_widget parameter is deprecated [1]. If one is passed, we
remove GDK_HINT_BASE_SIZE and GDK_HINT_RESIZE_INC from the mask [2].

[1] commit 08974a1e9a
[2] commit f7cc4abbad

https://bugzilla.gnome.org/show_bug.cgi?id=764321
2016-03-30 13:21:50 +02:00
Debarshi Ray
27a1b50bc6 window: Fix gtk_window_set_geometry_hints documentation
The geometry_widget parameter is ignored from 3.20 onwards [1], not
3.18 as mentioned in the documentation.

[1] commit 08974a1e9a

https://bugzilla.gnome.org/show_bug.cgi?id=764321
2016-03-29 19:31:59 +02:00
Benjamin Otte
a91237d65e window: Remove suspicious branch
While this commit was found to make emacs windows shrink (and it was
reverted in the gtk-3-20 branch for that reason), that was the only
observed breakage, while the reversal broke several of our unit tests.

Closer study of the emacs sources revealed that it does some really
unsupportable things like doing its own X event handling behind GTK+'s
back and freely mixing sizes of GtkWindows and GdkWindows obtained in
various ways. I've filed a bug against emacs with suggestions for how
to avoid the shrinking window, regardless of this commit.

Original commit message:

It seems this branch is not needed anymore. It was originally added in
1999 to support gtk_widget_realize(), but all those reasons seem
obsolete today.
Instead just call gtk_widget_realize().

If you end up at this commit when bisecting:
There is no bug that made me remove this code, it was purely meant to be
cleanup / dead code removal. I seem to have introduced a new bug or
bisecting wouldn't have let you here. So it seems we should just revert
this commit.
2016-03-28 17:05:09 -04:00
Matthias Clasen
e2d89b9931 Revert "window: Remove suspicious branch"
This reverts commit 67ab00e01e.

Bisection showed that this commit caused emacs windows to shrink
to a small size when first shown.
2016-03-26 17:38:40 -04:00
Olivier Fourdan
5d34cf64a2 popover: raise when showing
Some other widget might have mapped and raised another child window of
the toplevel in the meantime, causing the popover window to be covered.

Raise the popover window to avoid the issue.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=763627
2016-03-25 17:23:34 +01:00
Руслан Ижбулатов
404a7185be Improve window title context popup menu fallback
Add "Minimize", "Maximize", "Restore", "Move", "Resize" and "Always on Top"
items to the menu.
This pertially reverts commit 0ea1a526f9.

https://bugzilla.gnome.org/show_bug.cgi?id=763806
2016-03-20 22:02:23 -04:00
Olivier Fourdan
3e3d29f7b7 gtkwindow: ignore default size if there is a size request
Some applications set both a default size on their gtk window and a size
request on the corresponding gtk widget.

Until now, the default size was ignored for fixed size windows, so this
had no effect and remained unnoticed, but with the recent change for
client-side decorations, the default size is now used even for fixed size
windows, which can cause the resulting fixed size window to be much
smaller than expected with the size request.

For fixed size windows, if we have both a size request and a default
size set, prefer the size request as before.

https://bugzilla.gnome.org/show_bug.cgi?id=763749
2016-03-17 22:40:42 -04:00
Cosimo Cecchi
d61c2b4cce window: stop stomping on resize-mode set by external API
commit c3dc0d80f1 fixed the behavior of
GtkContainer widgets requesting an IMMEDIATE resize-mode.

However, GtkWindow has been stomping on resize-mode during realize()
since commit addcc64b9c. The combination
of factors that led to this not being a visible problem during all this
while is uncertain, but this now causes the Shell to continuously try to
relayout its ShellEmbeddedWindow (a GtkWindow subclass).

This commit separates the resize-mode as set internally by GtkWindow
from the one set with the external API, so that GtkWindow only changes
it when it had not been set before by the subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=763650
2016-03-14 16:10:15 -07:00
Carlos Garnacho
83cc7f76d7 GtkWindow: Make it an application/x-rootwindow-drop destination
This makes toplevels pseudo-transparent wrt this mimetype, so if
the drag source offers this mimetype and not another that was
managed by the destination-side widget hierarchy, the window will
be an acceptable target for this mimetype, allowing it to trigger
whatever is meant to in the source side.

https://bugzilla.gnome.org/show_bug.cgi?id=763387
2016-03-14 16:16:32 +01:00
Matthias Clasen
ed5468e81c window: Avoid excessive resizing with popovers
Under Wayland, popovers use subsurfaces, and we end up getting
configure events for these delivered to the toplevel they're in.
To avoid triggering resize loops, ignore configure events that
are not for the toplevel window itself.

https://bugzilla.gnome.org/show_bug.cgi?id=763351
2016-03-09 08:58:23 -05:00
Olivier Fourdan
cdc580463e gtkwindow: default size with fixed size windows
Allow fixed size windows with a default size to grow or shrink as the
content requires, but not smaller than the given default size.

https://bugzilla.gnome.org/show_bug.cgi?id=762974
2016-03-04 20:17:50 -05:00
Olivier Fourdan
adcd1ce2d3 gtkwindow: windows with a fixed size can shrink
One important aspect of non-resizable windows that we need to preserve
is that they shrink when their content requires less size.

Previous changes to allow the default size to be applied to fixed size
windows would have prevented all fixed size windows from shrinking when
their content requires less size.

Allow shrinking for fixed-size windows unless a default size was
specified.

https://bugzilla.gnome.org/show_bug.cgi?id=762974
2016-03-04 14:35:23 -05:00
Olivier Fourdan
4a729dc233 gtkwindow: Fix regression with fixed size windows
Previous commit to address the default size introduced a regression
with fixed size windows if no default size was given, the resulting
window would end up much smaller than its actual content.
2016-03-03 17:50:19 +01:00
Olivier Fourdan
0f95472581 gtkwindow: Use default size even if not resizable
If a window is not resizable (with gtk_window_set_resizable ()),
the size given with gtk_window_set_default_size() is ignored.

The solution to this would be to use gtk_widget_set_size_request() but
that's a GtkWidget API and therefore does not take into account the
client side decorations when in use with GtkWindow.

Refactor the code so that gtk_window_set_default_size() (which is a
GtkWindow API) gives the expected result on non-resizable windows as
well.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762974
2016-03-03 09:13:32 +01:00
Руслан Ижбулатов
7eb9f5f8ef W32: Prefer CSD by default
Will make GTK+ more willing to use CSD for all normal windows without
being asked to. Lack of desktop composition will, of course, prevent
it from using CSD (in theory).

GTK_CSD=0 will force CSD to NOT to be used whenever
possible (i.e. in cases where CSD is not specifically requested
by a window, by design).

https://bugzilla.gnome.org/show_bug.cgi?id=759899
2016-03-03 07:41:06 +00:00
Matthias Clasen
0ac71e81cf Drop some unused debug printfs
Remove some debug spew that has been ifdef'ed out for years
and does not look useful enough to keep.
2016-02-28 21:40:23 -05:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Benjamin Otte
e45cb3340c window: Include decoration border and padding in resize area
This is relevant for the Windows theme, which is the only theme that
uses padding on decorations. All other themes are unaffected.
2016-02-27 03:59:20 +01:00
Benjamin Otte
5df1e98b2a window: Draw decorations in the right place
When we draw our own shadows, we need to offset the calls to render the
background to the border rectangle.
2016-02-25 23:21:29 +01:00
Matthias Clasen
4e2674edbb Expand the docs for gtk_window_set_default_size()
Mention that this function should be used together with
gtk_window_get_size() when saving and restoring window sizes.
2016-02-15 08:23:12 -05:00
Timm Bäder
c360b5fb49 Remove more unnecessary redraws
The call to gtk_widget_set_state_flags immediately before these already
queues a redraw/allocate/resize in case they have to be queued.
2016-02-07 19:16:26 +01:00
Matthias Clasen
625f3e5f39 window: Always disconnect signal handlers
We connect to the titlebar widgets change notification regardless
whether it is internally created or not, so don't make the signal
handler disconnection conditional on that either.
2016-01-27 13:09:40 -05:00
Allison Ryan Lortie
0d109867d2 Tweak startup-notification after the first window
Presently, Gtk will only send a startup notification completion message
for the first window that is shown.  This is not good for the case of
GtkApplication, where we are expected to participate in
startup-notification for all windows.

We have avoided this problem by manually emitting the startup complete
message from after_emit in GtkApplication.

Unfortunately, this causes problems for windows that are shown with a
delay.  It is also a dirty hack.

The reason for the original behaviour is simple: there is a static
boolean in gtkwindow.c which controls it.  We remove this.

Instead, clear the startup notification ID stored in GDK when sending
the completion message.  GtkApplication will re-set this the next time
an event comes in which needs startup-notification handling.  In the
non-GtkApplication case, newly shown windows will still not send the
message, since the cookie will have been cleared.

Finally, we remove the hack from GtkApplication's after_emit.

This will probably cause some regressions in terms of lingering startup
notification messages.  The correct solution here is to always use
gtk_window_present(), including when merely opening a new document (with
a new tab, for example).

https://bugzilla.gnome.org/show_bug.cgi?id=690791
2016-01-27 18:14:40 +01:00
Matthias Clasen
cf3a781d32 Fix a typo 2016-01-26 20:57:50 -05:00
Benjamin Otte
84b788c4a5 window: Deprecate gtk_window_parse_geometry()
Geometry handling in GTK is deprecated.
2016-01-27 02:11:06 +01:00
Benjamin Otte
b22fdf24e0 window: Deprecate gtk_window_set_default_geometry()
We don't support geometries anymore.
2016-01-27 02:11:06 +01:00
Matthias Clasen
00aca5d689 Expand window style class documentation a bit 2016-01-17 12:13:59 -05:00
Olivier Fourdan
28f011eb05 wayland: prefer subsurface when possible
Quite a few applications use GTK_WINDOW_POPUP to create various
temporary windows and place then on screen. That works fine on X11 but
on Wayland there is no global coordinate system for regular surfaces.

If the application is using a gdk temp window and set a parent with
gtk_window_transient_for(), the gdk wayland backend has all it needs to
create a subsurface that can be placed at will by the application.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=759738
2016-01-08 10:33:26 +01:00
Cosimo Cecchi
ef8a5fc542 window: remove unused variables 2016-01-03 00:54:16 -08:00
Christoph Reiter
6d77b9f316 gtkwindow: fix first allocation size
67ab00e01e removed the fake configure code in gtk_window_show() and
replaced it with a simple gtk_widget_realize(). The initial allocation
code in realize() only allocates the natural size or the last requested
size which now no longer is set, resulting in a too small first allocation.

This builds a configure request to compute the allocation size instead
which includes default size, CSD etc..

This problem could be seen in case of a GtkPaned in a GtkWindow with a
default size set and the pane position set as well. The first allocation
would be the natural size of the GtkPaned which would clamp the pane
position if too larg. Only the second allocation would fill the parent
window using the now wrong pane position.

https://bugzilla.gnome.org/show_bug.cgi?id=759705
2016-01-02 22:12:12 -05:00
Matthias Clasen
e93d64e4c3 Revert "Revert "window: Remove suspicious branch""
This reverts commit 2438a06d54.

See https://bugzilla.gnome.org/show_bug.cgi?id=759705
2016-01-02 22:12:12 -05:00
Matthias Clasen
8bfbb2c103 Cosmetic change 2015-12-26 21:42:10 -05:00
Matthias Clasen
2438a06d54 Revert "window: Remove suspicious branch"
This reverts commit 67ab00e01e.

See https://bugzilla.gnome.org/show_bug.cgi?id=759705
for a case where this makes a difference.
2015-12-22 07:36:58 -05:00
Daiki Ueno
75b3eec7a6 inspector: Avoid crash when canceling at startup
When clicking "Cancel" on the "Do you want to use GTK+ Inspector?"
dialog, unregister the update_debugging idle handler.  Also, steal
reference to 'inspector_window' while gtk_destroy_widget(), to make
further gtk_window_update_debugging() calls as a no-op.

https://bugzilla.gnome.org/show_bug.cgi?id=759764
2015-12-22 12:52:27 +09:00
Carlos Garnacho
4f9f3f04c0 GtkWindow: Add ignore deprecation statements
We still need access to floating devices at places
2015-12-16 19:47:07 +01:00
Carlos Garnacho
4a7589ea12 GtkWindow: Avoid GdkDeviceManager API
We can iterate over the seats' pointers, instead of over master pointers.
2015-12-16 19:47:07 +01:00
Matthias Clasen
2f544655f9 Revise CSS node documentation
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00
Carlos Garnacho
6ac16dc4a6 GtkWindow: Avoid gdk_device_manager_get_client_pointer()
It's now deprecated
2015-12-15 23:16:11 +01:00
Benjamin Otte
5cbbc62026 widget: Pass a GtkCssStyleChange instead of a bitmask 2015-12-13 04:11:58 +01:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Matthias Clasen
f7cc4abbad Avoid ugly seams on half-tiled terminals
Since we're no longer doing geometry widgets, don't send
base size and increments to the window manager anymore either.
This avoids an ugly 2 pixel gap to the right and bottom of half-tiled
terminals under gnome-shell.
2015-12-07 10:11:06 -05:00
Matthias Clasen
93b3669273 Be forgiving if cursors are missing
No need to crash here. Missing cursors are ugly, but we
shouldn't crash.
2015-12-05 18:55:05 -05:00