Commit Graph

842 Commits

Author SHA1 Message Date
Matthias Clasen
d31391b0c7 csd: Ignore titlebars when hidden
We were not drawing the content background in the titlebar
area when fullscreen, and were still treating clicks there
as if they were on the titlebar.
2013-05-12 21:01:59 -04:00
Matthias Clasen
759f223396 csd: Manage visibility of custom titlebars
We should hide custom titlebars when in fullscreen mode, just
as we do for non-custom titlebars.
https://bugzilla.gnome.org/show_bug.cgi?id=700053
2013-05-12 21:01:59 -04:00
Matthias Clasen
42ee21e34c Make gtk_window_resize work again
This hunk of code was lost by accident in the previous commit.
2013-05-11 19:44:57 -04:00
Matthias Clasen
fc10ee8d4a GtkWindow: default size is only for initial map
Bring back need_default_size. We need it to preserve this
documented behavior:

The default size of a window only affects the first time a window is
shown; if a window is hidden and re-shown, it will remember the size
it had prior to hiding, rather than using the default size.

With this patch, all of the window sizing tests in
gtk/tests/window pass again.
2013-05-11 18:49:51 -04:00
Matthias Clasen
3b4804bbf1 Always use gint for border_width
This avoids an evil trap when doing MAX (..., ... - 2 * border_width)
and the expression on the right gets promoted to unsigned, instead
of going negative as you would expect.
https://bugzilla.gnome.org/show_bug.cgi?id=699633
2013-05-04 19:21:56 -04:00
Ignacio Casal Quinteiro
38688cad00 window: handle titlebar property for the buildable interface 2013-05-04 23:04:55 +02:00
Benjamin Otte
43e6b3aa03 window: Handle attach widget disappearing without weak pointers
Fixes the window not emitting a "notify::attached-to" signal when the
attach-widget goes away.
2013-05-02 16:26:37 +02:00
Matthias Clasen
fb08a26acd GtkWindow: use a weak ref to keep track of attach_widget
Taking a full reference of the attach widget creates a reference
cycle, and keeps the attach_widget alive longer than it should.
2013-05-02 08:01:14 -04:00
Benjamin Otte
2d29c4a43f window: last size is more important than default size
reorder size computation code to reflect that.

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-05-01 16:41:12 +02:00
Benjamin Otte
01f7ed1d07 window: Deprecate gtk_window_reshow_with_initial_size() 2013-05-01 16:41:12 +02:00
Cosimo Cecchi
009aadf378 window: remove unused code
We don't need to add these style classes.
2013-04-22 18:10:22 -04:00
Cosimo Cecchi
7bbbb01ff5 window: rework the CSD theming layer
Instead of having three different boxes and style classes, we can just
get away with the regular background box, plus a window-frame, which
contains the external frame, together with the window drop shadows.

GtkWindow now has special code to ensure the backing actual window is
allocated big enough to accomodate the shadows (using the shadow size
calculations introduced in the previous commit). We also use the margin
value to determine the size of the invisible borders (which can then be
different than the shadow).
2013-04-22 18:10:22 -04:00
Cosimo Cecchi
7846bedebd window: factor out a gtk_window_get_maximized() function
Simplify code that does this same check over and over.
2013-04-22 18:10:21 -04:00
Cosimo Cecchi
87922575d3 window: remove title_border
We don't actually need this additional title border.
2013-04-22 18:10:21 -04:00
Cosimo Cecchi
44ba055d03 window: don't forget to fetch title border when not on CSD
We still need to respect this border value even when we're not running
under CSD, since we support setting a custom titlebar in all cases.

The border/style magic in gtk_window_draw() really needs to be separated
out into logical pieces soon, but for now let's keep a consistent
behavior with the previous code.
2013-04-21 16:59:14 -04:00
Cosimo Cecchi
a25e0a97d5 window: only account for decoration borders when we're client decorated 2013-04-21 14:44:24 -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
Matthias Clasen
ff56d02d7b csd: Don't use a content_window for o-r windows
This fixes drawing of dnd icons.
https://bugzilla.gnome.org/show_bug.cgi?id=697886
2013-04-12 22:49:40 -04:00
Matthias Clasen
c402e89299 csd: Use symbolic icons for window buttons
With symbolic icons, we can recolor the icons as needed, and we
can use icon shadows, etc.
2013-04-10 06:13:26 -04:00
Benjamin Otte
c4dc0e8e40 window: Remember current size
Don't just look at previously remembered sizes, also look at the current
size.
This is useful for cases where the window was resized by the user or WM
and not by the application itself.

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-04-09 12:09:12 +02:00
Benjamin Otte
70dbb14f89 window: Split out a function
We don't want to remember sizes in the not resizable case. Also a
function named "guess_default_size" should not look at previous sizes,
it should guess.
2013-04-09 12:09:12 +02: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
Benjamin Otte
21f11eb0e6 window: restore size after hide/show properly
Old code assumed the size was stored in widget.allocation. This is no
longer true as the allocation is cleared upon hide. However, we store
the last configure request, and that one tracks the last size, so we can
just use that number.

Sometimes things are so easy - once you figure them out...

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-04-08 16:34:19 +02:00
Matthias Clasen
e47689d9ea csd: Implement hide-titlebar-when-maximized 2013-04-06 17:24:29 -04:00
Sébastien Wilmet
14c9023a05 GtkWindow: fix notify of :attached-to
https://bugzilla.gnome.org/show_bug.cgi?id=697200
2013-04-03 19:32:21 +02:00
Cosimo Cecchi
a60ddd9a02 window: don't schedule a display of mnemonics if window has no modifier
When the window has no mnemonics modifier set, as in the case of a
GtkMenu, never schedule a display of mnemonics on focus-in.

Previously, for those windows, the GdkModifierType mask fetched from the
device would typically have been zero, leading to the

mnemonic_modifier == (mask & gtk_accelerator_get_default_mod_mask ())

check to succeed, so we would always trigger a display for popup menus.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:44 -04:00
Cosimo Cecchi
cfb1e56561 window: refactor a function
Instead of having maybe_set_mnemonics_visible(), separate the checks
from the actual scheduling of mnemonics display.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:43 -04: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
Cosimo Cecchi
68b437eea2 window: reset timeout source id before setting property
gtk_window_set_mnemonics_visible() will try to g_source_remove() it
otherwise, which seems harmless, but conceptually wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:39 -04:00
Benjamin Otte
f47f94be42 window: Remove call to gtk_widget_reset_rc_styles()
First of all, that call is deprecated. Second, we don't have RC styles
anymore. Third, what that function does today is invalidate style
contexts, but that happens automatically when setting the screen on the
style context later.

So this function is completely unnecessary.
2013-04-02 11:45:44 +02: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
Matthias Clasen
d1ad324d3d csd: Reparent the content
This lets us avoid problems with cursor changes.
2013-03-24 01:15:33 -04:00
Matthias Clasen
69f12b1090 Don't react to clicks in content
This breaks way too many things, and we explicitly trigger
drags from menubars and toolbars, where we want it.
2013-03-21 18:07:21 -04:00
Matthias Clasen
6eaa5ffa8a csd: Allow moving maximized windows
This make the nice 'snap off' feature of gnome-shell work
with client-side decorations. weston moves the maximized window
around, which is less ideal...
2013-03-21 18:07:21 -04:00
Cosimo Cecchi
8fd9575ab6 window: don't add the background style class when drawing CSD elements
We already set it in init, so this is just redundant.
The additional window-content style class here is needed so that we can
distinguish between the full X window background and the background for
the actual window contents.
2013-03-21 16:32:00 -04:00
Cosimo Cecchi
4bcaadac51 window: add a "client-decorated" style class when the window is so
The theme might want to apply some specific theming to a client
decorated toplevel window, so add a style class for that.
2013-03-21 16:31:14 -04:00
Matthias Clasen
da2a102adb GtkWindow: clean up button event handling
We were not translating event coordinates to the toplevel
window, thus the regions we determined were not right.
We were also not respecting the maximized state, and we
were unnecessarily refusing to handle events when not decorated.
https://bugzilla.gnome.org/show_bug.cgi?id=696197
2013-03-20 18:21:12 -04:00
Rob Bradford
8cdbee7fd2 window: Use update_window_buttons to hide title on fullscreen
The function update_window_buttons shows or hides the title header after it
has finished updating the visibility of the various buttons. Unfortunately
this
conflicted with the hiding of the title done when going fullscreen.

This solves the problem and fixes the rendering of fullscreen applications by
using update_window_buttons to control the visibility of the box in the
fullscreen case.
2013-03-19 19:48:35 +00:00
Matthias Clasen
30d0542309 Add documentation for gtk_window_set_titlebar 2013-03-18 08:50:22 -04:00
Matthias Clasen
4afbaf699f Add gtk_window_set_titlebar
A new function that sets a custom titlebar on a GtkWindow.
With client-side decorations, the custom titlebar simply
replaces the one that GtkWindow would otherwise create itself.
With traditional decorations, we tell the window manager
to just decorate the window with a border. This works ok
at least with metacity and mutter.
2013-03-18 08:50:22 -04:00
Matthias Clasen
105c808d0a Small cleanup in gtk_window_draw
Get the allocation once, at the beginning.
2013-03-18 08:50:22 -04:00
Matthias Clasen
4a2c3bbf3c window: Don't draw titlebar background
GtkHeaderBar can do its own drawing, no need to do this
in gtk_window_draw.
2013-03-18 08:50:22 -04:00
Matthias Clasen
e29c25cd1b Trivial whitespace fix 2013-03-18 08:50:22 -04:00
Matthias Clasen
63f0f03a73 Add forgotten check
We don't want to create titlebar widgets if the window
is not decorated anyway.
2013-03-18 08:50:21 -04:00
Matthias Clasen
bec5798180 Fix a typo 2013-03-18 01:20:08 -04:00
Matthias Clasen
2fe07c9068 Fix double accounting of border width
For csd, we were subtracting the border width one too many
times from the child height, causing clipped off content e.g.
in the 'Properties' window in testgtk.
2013-03-17 19:01:25 -04:00
Matthias Clasen
75a1e8251e Allocate the titlebar height according to width 2013-03-17 19:01:25 -04:00
Matthias Clasen
a41f7e4741 window: Render inner and outer border separately
This lets themes render a window frame in the inner border,
and a shadow or nothing in the outer border.
2013-03-17 12:19:50 -04:00
Matthias Clasen
70ccfb0efc window: Split the border into inner and outer
For now, nothing changes, we're using the sum of inner and
outer border everywhere.

In the future, we will make the inner border the visible
window frame, and the outer border the shadow/resize border.
2013-03-17 12:19:50 -04:00
Matthias Clasen
41aad21693 window: Hide the border when maximized
Dragging windows from the border is not useful when maximized.
2013-03-17 12:19:50 -04:00
Matthias Clasen
003d9f4225 window: Add a window menu to the titlebar
The menu is triggered by right-click on the titlebar
or with the menu key.
2013-03-17 12:19:50 -04:00
Matthias Clasen
bf03c85e43 window: Allow resizing by clicking on the border
We also change cursors to indicate what interactions
are possible in various window regions.
Double clicking on the titlebar maximizes the window.
2013-03-17 12:19:50 -04:00
Matthias Clasen
037b1435ae window: Allow theme control over window buttons
Add a style property to control the presence and order of
window buttons. We allow buttons at the left and right side,
they can be specified like this: icon,close:minimize,maximize.

Also, change the default button layout back to have just a close
button on the right, use icons in buttons, and set style classes
on the buttons, to allow better theming.
2013-03-17 12:19:50 -04:00
Matthias Clasen
93c345e49f window: Hide frame buttons when appropriate
Hide the close button if the window is not deletable, hide the
maximize button if the window is not resizable, and hide all
buttons if the window is a dialog.

Update buttons when the window state changes.
2013-03-17 12:19:49 -04:00
Matthias Clasen
d05d08a2f3 window: Use same title fallback mechanism as X backend
This looks at the application name or program name and uses that
as the title if gtk_window_set_title has not been called.
2013-03-17 12:19:49 -04:00
Matthias Clasen
b141121ef6 window: Add support for enabling client decorations on non-Wayland
Client side decorations can be enabled on non-Wayland platforms by
setting the GTK_CSD="1" environment variable.

We must ensure we have a GdkVisual that has an alpha channel since
the decorations rely on transparency. If we cannot get a visual with
an alpha channel then we do not enable client side decorations.
2013-03-17 12:19:49 -04:00
Rob Bradford
f17b7136dd window: Hide the decorations on fullscreen
This is expected behaviour for fullscreen windows.
2013-03-17 12:19:31 -04:00
Rob Bradford
4618e0dcc7 window: Don't set a background pattern/colour when client decorated
Otherwise we'll potentially get some background sticking through our rounded
corners in our decorations. The actual background will get drawn as part of
the decoration drawing.
2013-03-17 12:13:35 -04:00
Kristian Høgsberg
6a8362111e window: Add initial support for client-side decorations under Wayland
This change comprises four main parts:
 * the creation of the widgets that form the decorations,
 * implementation of get_preferred_height/width, and the for_width/for_height
   variants,
 * taking the decorations into account when allocating,
 * and drawing the decorations themselves.

Kristian did the bulk of the original work on this but any bugs are almost
certainly mine through the many refactorings and rebasings.
2013-03-17 12:13:35 -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
Will Thompson
507bf6e5cf docs: correct various spelling and grammar errors
I noticed a few cases of "wether", and while fixing them noticed a few
"its" which should be "it's". It all went downhill from there.
2013-03-04 22:48:22 +00:00
Rob Bradford
fe5146d8f2 window: Fix compiler warning when not building for X11
The callback function gtk_window_on_theme_variant_changed is only used on the
X11 backend (where GtkSettings is used for the settings information.)

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=674207
2013-02-19 13:11:30 +00:00
Owen W. Taylor
645b5f398d Reimplement _NET_WM_SYNC_REQUEST inside X11 backend
Deprecate gdk_window_enable_synchronized_configure() and
gdk_window_configure_done() and make them no-ops. Implement the
handling of _NET_WM_SYNC_REQUEST in terms of the frame cycle -
we know that all processing will be finished in the next frame
cycle after the ConfigureNotify is received.
2013-02-14 17:19:51 -05:00
Alexander Larsson
fa8b71450c Add gtk_widget_get/set_opacity
This adds gtk_widget_get/set_opacity, as well as a GtkWidget.opacity
property. Additionally it deprectates gtk_window_get/set_opacity and
removes the GtkWindow.opacity property (in preference for the new
identical inherited property from GtkWidget, which should be ABI/API
compat).

The implementation is using the new gdk_window_set_opacity child
window support for windowed widgets, and cairo_push/pop_group()
bracketing in gtk_widget_draw() for non-window widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Alexander Larsson
3d4cd4db3e Add gtk_widget_(un)register_window
This replaces the previously hardcoded calls to gdk_window_set_user_data,
and also lets us track which windows are a part of a widget. Old code
should continue working as is, but new features that require the
windows may not work perfectly.

We need this for the transparent widget support to work, as we need
to specially mark the windows of child widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Benjamin Otte
e84ed710a2 window: allocation x/y is 0,0
This was incorrect in 97ba4b1b8e.
2013-01-17 20:56:31 +01:00
Benjamin Otte
97ba4b1b8e window: Don't use set_allocation() to store cached values
The window size can be queried on widget->window directly, no need to
store it in widget->allocation.
This change is necessary because gtk_widget_set_allcation() is now
checking invariants that assume it's called from insize
gtk_widget_size_allocate() and that wasn;t the case here.
2013-01-14 18:13:10 +01:00
Alexander Larsson
d3377e9d7a Don't unnecessarily queue resize in GtkWindow.style_updated
GtkWindow always queues a resize on style updates if there is
a grip, because it may have been the grip size style properties
that changed. However, even if it *were*, and it likely wasn't
that would not affect the windows size request, so no need
to queue a resize.
2012-12-04 21:24:24 +01:00
Benjamin Otte
5671a869c2 Revert parts of "window: Remove useless functions"
This reverts the size_allocate removal from commit
8449e05865. That code was using
_gtk_window_set_allocation() instead of gtk_widget_set_allocation(). And
that broke glade.
2012-11-14 20:12:30 +01:00
Benjamin Otte
8449e05865 window: Remove useless functions
Now that GtkBin implements sizing functionality, there's no need to do
the same in GtkWindow
2012-11-11 20:26:28 +01:00
Rui Matos
1b5dabac8b window: Delay showing auto mnemonics on focus in
Just as in ed7a417dcb we don't want to
show auto mnemonics immediately but only after a short delay. In
particular this allows to capture screenshots without visible
mnemonics.

https://bugzilla.gnome.org/show_bug.cgi?id=684517
2012-10-02 16:41:40 +02:00
Benjamin Otte
e1e9dec1b2 window: Add the .background class to windows unconditionally 2012-09-17 20:39:11 +02: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
Benjamin Otte
2cb9dac14c stylecontext: Pass the changes in the parent to validation function
This way, inherited properties can be updated.
2012-08-28 15:42:23 +02:00
Lars Uebernickel
ab3b41374a Add two users of gtk_widget_insert_action_group
Each GtkWindow with an associated GtkApplication should add this as
"app" to its action context.  Each GtkApplicationWindow is its own
GActionGroup, and it should add itself to itself with the prefix "win".

There is now some duplication here because we have the new GActionMuxer
hierarchy managed by GtkWidget, but GtkApplicationWindow still carries
its own muxer.  The redundancy will be removed in a future patch.
2012-08-20 13:11:01 -04:00
Rob Bradford
f061990bd5 window: Update _gtk_window_set_is_active API comment
The comment referenced GTK_TOPLEVEL which has been replaced by
GTK_WINDOW_TOPLEVEL.
2012-07-28 15:19:28 +01:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Matthias Clasen
644d62e2ce Trivial: remove a bit of obfuscation 2012-05-30 13:46:39 -04:00
Rui Matos
4d7c7ec32f window: Remove needless call to ensure_state_flag_backdrop() on map
This call was forcing needless work since gtk_window_map() already
does a gdk_window_show() which initially sets GDK_WINDOW_STATE_FOCUSED
that we then handle regularly on the widget's window state event
handler.

https://bugzilla.gnome.org/show_bug.cgi?id=673237
2012-05-03 17:24:05 -07:00
Benjamin Otte
d22a632b54 window: Validate style context before first allocation
When we don't do that, we completely botch sizing popups. Not good.

Fixes remaining failing reftests
2012-05-02 02:00:11 +02:00
Benjamin Otte
090f30c559 container: Remove duplicated flag
GtkContainer::need_resize and GtkWidget::alloc_needed are the same
thing.
2012-04-17 08:59:22 +02:00
Benjamin Otte
e7a984b337 window: Set parent context instead of just resetting style
Otherwise the inherit properties won't inherit properly.
2012-04-17 08:59:10 +02:00
Matthias Clasen
050cba6a31 Fix malformed doc comments
Most of these are forgotten :'s and similar details
which gtk-doc now warns about.
2012-04-12 21:12:16 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Rob Bradford
a2792b983c window: Fix typo in documentation for gtk_window_get_position 2012-02-23 11:45:49 +00:00
Michael Natterer
914053a2a3 gtk_window_set_attached_to: ref(), not ref_sink() the attach_widget
The attached popup doesn't take ownership of its "parent" widget, so
ref_sink() was wrong, and caused widgets to be leaked.
2012-02-21 01:06:43 +01:00
Benjamin Otte
f01cef05c8 window: Avoid unnecessary attach-widget resets 2012-01-31 03:43:43 +01:00
Matthias Clasen
691a94214a Fix doc syntax 2012-01-20 08:17:39 -05: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
Ryan Lortie
ba9546ff32 Don't call set_application() in gtk_window_realize
This call has no effect and with the newly-added restrictions it's
violating the set-application-after-realized rule.

https://bugzilla.gnome.org/show_bug.cgi?id=668203
2012-01-18 14:53:08 -05:00
Ryan Lortie
85fcd50b3f Revert "set the G_PARAM_CONSTRUCT flag on the GtkWindow:application property"
This reverts commit d4fe912879.

This patch caused some unanticipated compatibility issues.
2012-01-17 10:56:30 -05:00
Matthias Clasen
46ee761c0d Expand the docs for GtkWindow::attached-to 2012-01-12 20:39:48 -05:00
Cosimo Cecchi
c4a13b5287 window: improve docs for gtk_window_set_attached_to() 2012-01-12 14:03:00 -05:00
Andrea Cimitan
4a18fe7ef2 Introduce gtk_window_get/set_attached_to()
gtk_window_get/set_attached_to() is a new API that allows for windows to
be attached to a GtkWidget.
The attachment is a logical binding between the toplevel window and the
widget that generated it; this kind of information is currently used to
propagate style information from the widget to the window, but is also
useful e.g. for accessibility.

https://bugzilla.gnome.org/show_bug.cgi?id=666103
2012-01-12 14:03:00 -05:00
Guillaume Desmottes
d4fe912879 set the G_PARAM_CONSTRUCT flag on the GtkWindow:application property
This allows subclass to get the value of this property in their constructed
method.

https://bugzilla.gnome.org/show_bug.cgi?id=667628
2012-01-10 16:03:57 +01:00
Rui Matos
e9adaabc5e Rename 'window-unfocused' to 'backdrop'
'window-unfocused' is too long and mentions "focus" which is historically
loaded with the meaning "input focus".

'backdrop' isn't generally used in GUI speak and still conveys the state the
widgets in an unfocused or background toplevel window are in.
2012-01-09 18:38:00 +01:00
Rui Matos
09979513b2 window: Stop setting state flags on the style context for drawing
This also removes setting the FOCUSED state flag when
gtk_window_has_toplevel_focus() since this effect can now be done with the new
WINDOW_UNFOCUSED flag instead which actually works better regarding X grabs
and modal windows.
2012-01-09 16:45:44 +00:00
Matthias Clasen
69a529572d Revert "GtkWindow: new API to store state in GSettings"
This reverts commit 730765de91.

This needs more thought, committing it on the same day as filing
the bug was premature.
2012-01-09 00:53:53 -05:00
Ryan Lortie
730765de91 GtkWindow: new API to store state in GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=667438
2012-01-06 16:18:48 -05:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Chun-wei Fan
d273b817e8 Bug 667018-gtk/gtkwindow.c: Include deprecated/gtkstyle.h
This is needed for the prototype of gtk_widget_reset_rc_styles, to avoid
C4013/implicit declaration of ... warnings of that function
2011-12-30 17:25:48 +08:00
Ryan Lortie
90fcf994d5 GtkApplication: export windows on the bus
And advertise their location on the bus using X11 properties.
2011-12-19 12:51:11 -05:00
Colin Walters
9c52a73c21 window: Set a _DBUS_APPLICATION_ID X11 window property
This will allow gnome-shell to reference it.
2011-12-19 12:51:07 -05:00
Matthias Clasen
020c1846b7 Use the workarea when placing popups
This uses the new workarea API to avoid placing popups underneath
panels, docks, etc.
2011-12-18 14:29:16 -05:00
Florian Müllner
4f8f8fe828 window: Add hide-titlebar-when-maximized property
For maximized windows, titlebars cannot be used to reposition or
scale the window, so if an application does not use it to convey
useful information (other than the application name), the screen
space occupied by titlebars could be put to better use.
Add a new window property which requests from the window manager
to hide titlebars when windows are maximized to account for this.

https://bugzilla.gnome.org/show_bug.cgi?id=665616
2011-12-15 16:31:56 +01:00
Alexander Larsson
93c086ec80 Make window handle transparent
Instead of painting the window background on the grip_window we now
only paint it on the GtkWindow->window, and we make the grip_window
have a transparent background.

We can't really make transparent window handle background optional
via css atm, because the handle color is actually based on the
background color, so if that is set to transparent we won't draw
anything.
2011-12-05 12:51:55 +01:00
Michel Dänzer
ab34c79896 Fix gdk_cairo_region_create_from_surface on big endian
gdk_cairo_region_create_from_surface doesn't work correctly on PPC.
This is most prominently seen with the GTK window resize grip, the
shape of which is mirrored every eight pixels horizontally.

At the same time, use an A1 surface for the resize grip shape to
eliminates an A8->A1 surface conversion.
2011-11-19 12:23:27 -05:00
Benjamin Otte
1c22053baf window: Fix cast warnings 2011-11-08 21:14:05 +01:00
Rui Matos
70f87b8bd5 gtk: Add a GTK_STATE_FLAG_WINDOW_UNFOCUSED widget state flag
This allows themes to style widgets differently according to whether the
toplevel window they are in is presented as focused.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:33:22 +00:00
Matthias Clasen
7644ef1e3a GtkWindow: Use new begin_resize_drag api
We have an event, so the correct thing to do is to pass
the device into the function that we are calling. GDK
just grew a variant that takes a device, for this purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=663444
2011-11-05 01:14:30 -04:00
Rui Matos
2720574ab9 gtkwindow: Clean up gtk_window_map()
Remove unneeded variable and delete trailing whitespace.
2011-10-01 01:28:30 +01:00
Matthias Clasen
5ff8fe6971 Documentation fixes
Mostly making sure that return values and varargs don't loose
their docs.
2011-09-25 21:04:49 -04:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Matthias Clasen
ed08baccd9 Convert GailWindow to GtkWindowAccessible
While doing this, drop the get_mdi_zorder implementation
that really should come from the window manager side. Dropping
this saves some 500 lines.
2011-07-05 16:08:57 -04:00
Matthias Clasen
f1a9c3efff Remove unused includes
Nothing is using gtkrc.h functionality any more.
2011-06-16 23:33:43 -04:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Javier Jardón
7b0d77def5 gtkcontainer: Move private functions to private header
https://bugzilla.gnome.org/show_bug.cgi?id=651707
2011-06-06 12:10:29 +01:00
Benjamin Otte
97a8ff80cc window: Only draw resize grip if its window exists
Don't rely on priv->resize_grip_visible as the code comment in the
variable declaration indicates.
This fixes warnings with GtkPlug, which can cause resize_grip_visible to
be TRUE but grid_window to be NULL - running tests/teststatusicon
reproduces this.

This broke with 7ef113ce56
2011-05-23 15:56:09 +02:00
Matthias Clasen
73bf1740e9 Some additional auto-mnemonic fixes
Previously, we would also show mnemonics if the user hits
Ctrl+Alt, even though Ctrl+Alt+<x> does not actually trigger.
2011-05-06 14:10:23 -04:00
Rui Matos
6889d5b008 GtkWindow: set mnemonics visible on focus in if modifier is pressed
With gtk-auto-mnemonics on, we hide mnemonics on focus out. We should also
check if the modifier is pressed on focus in and if so, show mnemonics again.

https://bugzilla.gnome.org/show_bug.cgi?id=618815
2011-05-06 14:10:23 -04:00
Benjamin Otte
4f23dc34be window: Make non-resizable windows use default size for geometry hints
Previously, we were trying to size them by the default size, but then
setting the minimum size as the geometry hints' minimum and maximum
size.
2011-05-01 08:47:58 +02:00
Benjamin Otte
406b2e9e58 window: Remove overeagerness with new size guessing
Don't use the guessed size when we are interested in the minimum size.
So now we can really shrink menubars.

This reverts parts of 08b2ac1d90
2011-05-01 08:02:15 +02:00
Benjamin Otte
7962a4b716 window: Invert check that was wrong 2011-04-29 03:27:02 +02:00
Benjamin Otte
1763b3a0b5 window: Make comparison be the right direction
Messed something up there...
2011-04-27 15:27:52 +02:00
Benjamin Otte
85aebe74cf window: Be smarter about computing the default size
See the code comments for the reasoning behind this. After we don't
force a "guessed" minimum size for labels anymore, a lot of issues
started to surface that this patch attempts to fix. In particular:

1) Tooltips where wrapped as much as possible.
2) The recentchooser submenu displayed only ellipsize dots.
2011-04-27 00:27:29 +02:00
Benjamin Otte
08b2ac1d90 window: Split out size guessing function
This doesn't do anything special yet, but I'm about to change that.
2011-04-26 23:15:19 +02:00
Benjamin Otte
6e6837a130 window: Use int instead of uint consistently 2011-04-26 22:44:43 +02:00
Javier Jardón
9d63d16e3e Move documentation to inline comments: GtkWindowGroup 2011-04-18 02:08:37 +01:00
Benjamin Otte
7ef113ce56 window: Only draw the resize grip if it is actually visible
This issue can only be seen if someone calls gtk_widget_draw() on the
window as otherwise gtk_cairo_should_draw_window() would return FALSE.
2011-04-16 22:31:24 +02:00
Benjamin Otte
6b712ac93b window: cast value so gcc shuts up 2011-04-16 22:06:41 +02:00
Dan Winship
b5d678dab0 gtk_window_present_with_time: fix when window is not initially visible
When called on a hidden window, gtk_window_present_with_time() would
just fall back to gtk_widget_show(), completely ignoring the passed-in
timestamp. This ended up working anyway if the timestamp came from
in-process, since gdk_window_x11_show() would initialize its user_time
from the time of the most recent event. But if the timestamp came from
another process, this would result in the window being shown with an
out-of-date timestamp.

Fix this by remembering the timestamp from
gtk_window_present_with_time(), and then setting the GdkWindow's
user_time from that when it the window is realized.

https://bugzilla.gnome.org/show_bug.cgi?id=647275
2011-04-12 13:03:38 -04:00
Kristian Høgsberg
c7514e8f0d Merge branch 'gdk-backend-wayland'
Conflicts:
	Makefile.am
	configure.ac
	gdk/Makefile.am
	gtk/gtksettings.c
	gtk/gtkwindow.c
2011-04-12 09:52:44 -04:00
Matthias Clasen
3fbfd82e9e GtkWindow: rearrange private struct to fill some holes 2011-04-11 18:33:43 -04:00
Tristan Van Berkom
0b8a1dcac2 Fixed warning catch in gtk_window_compute_hints(). 2011-04-03 18:10:27 +09:00
Florian Müllner
16dc117045 window: Use settings from screen rather than default
gtk_settings_get_default() was used to monitor the
"gtk-application-prefers-dark-theme" setting, rather
than the GtkSettings object associated with the window's
screen.
2011-03-25 17:41:19 +01:00
Florian Müllner
3032fdce2a window: Export theme variant to X11
The metacity theme format allows to use colors from the current
GTK+ theme in window decorations. Since GTK+ now gained support
for dark theme variants, window managers using that theme format
(metacity, mutter, compiz via gtk-window-decorator) should be able
to use colors from the correct variant; so in case a variant is
requested, export it in the _GTK_THEME_VARIANT property on
toplevel windows.

https://bugzilla.gnome.org/show_bug.cgi?id=645354
2011-03-21 15:06:34 +01:00
Matthias Clasen
ddc588236b Add annotations to gtk_window_get_position
Part of bug 644353, patch by Ulrik Sverdrup.
2011-03-12 21:25:07 -05:00
Cosimo Cecchi
4a99e75ce7 window: don't confuse priv->type_hint with priv->gdk_type_hint
This broke, among the others, menu rendering.
2011-03-03 17:48:25 -05:00
Benjamin Otte
7693804fcf window: Add check for X11 window when calling x11 function 2011-03-02 17:29:21 +01:00
Kristian Høgsberg
287d91e5f9 Merge remote-tracking branch 'origin/master' into gdk-backend-wayland
Conflicts:
	gdk/gdkdisplaymanager.c
2011-02-26 14:44:29 -05:00
Murray Cumming
f91c04e284 Minor documentation improvements
Mostly correcting it's to its and changing some , to .
2011-02-23 10:26:21 +01:00
Kristian Høgsberg
b4129c14cb gtkwidget: Only call X GDK functions when the window is an X window 2011-02-10 13:44:45 -05:00
Matthias Clasen
beb8c290d1 Always chain up in ::style-updated
This was not handled consistently, but the default handler
does useful things, so we should always chain up.
2011-02-07 07:30:37 -05:00
Matthias Clasen
4dc9b294d8 Don't assume a screen exists before realize()
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=641429
2011-02-04 22:03:11 -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
Kristian Rietveld
9dcdca2501 Don't use GTK_IS_PLUG for non-X11 backends 2011-02-01 00:26:04 +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
7db4bee4b6 Clarify documentation about application vs window lifecycle
https://bugzilla.gnome.org/show_bug.cgi?id=639931
2011-01-24 22:20:35 -05:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Pavel Holejsovsky
2f0d40335b [GI] Add missing (transfer) annotations 2011-01-20 13:57:18 +01:00
Pavel Holejsovsky
a1c297a310 [GI] Cosmetic cleanups of annotations and doc comments
This change does not introduce any functionality change, mostly
cosmtic cleanups, like re-linebreak when introduced annotations messed
up indentation or whitespace errors fixes.
2011-01-18 17:31:59 +01:00
Pavel Holejsovsky
fe372ddf5e [GI] Add missing (allow-none) annotations 2011-01-18 17:30:43 +01:00
Pavel Holejsovsky
6d5cdad56e [GI] Annotate strings holding file paths as (type filename) 2011-01-18 17:29:40 +01:00
Garrett Regier
cb0fac73a5 Fix memory leak in gtk_window_group_list_windows 2011-01-17 08:23:59 -08:00
Matthias Clasen
efd0e6ec1f Add a setter for GtkWindow.has_user_ref_count
This is needed for some language bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=638880
2011-01-10 11:49:06 -05:00
Carlos Garnacho
f506fc3e93 Remove recent GtkStyle usage in GtkWindow
GtkStyleContext API is used instead.
2011-01-10 03:49:59 +01:00
Matthias Clasen
c396c52327 Documentation fixes 2011-01-06 08:12:01 -05:00
Tristan Van Berkom
44a9b1c35e Fixed statement in gtkwindow.c when toplevelness changes.
Fixed a typo when checking if the heirarchy toplevel is a toplevel
before firing the hierarchy-changed signal.
2011-01-06 14:39:41 +09:00
Tristan Van Berkom
a28295a742 Dont show the GtkWindow when removing it from a parent and becomming a toplevel
Showing the window causes it to try to grab focus, this causes problems
when embedded toplevels run through dispose cycles.
2011-01-06 14:39:41 +09:00
Tristan Van Berkom
b8c8f2ccb1 Fixed conflict while rebasing master. 2011-01-06 14:39:41 +09:00
Tristan Van Berkom
93c8058582 Fixed GtkWindow/GtkWidget to properly emit hierarchy changed for embedded toplevels
Now GtkWindow takes some measures when setting toplevelness:

  - When a window becomes toplevel after being embedded it saves
    the visibility state and reshow's itself so that the window
    re-realizes and presents itself again automatically

  - When emitting hierarchy-changed, synthetically mark the toplevel
    as not anchored, this allows the hierarchy changed propagation to
    recurse properly.

GtkWidget also takes care to unset the parent window *after* unparenting
the widget and after emitting the heirarhcy changed that leaves a NULL
toplevel.

That means there are now 2 cycles of "hierarchy-changed" when removing
an embedded toplevel from a parent, first one that makes the new toplevel
a NULL one (since the toplevel flag is not yet restored), the second cycle
makes the removed window toplevel again when setting the parent window
to NULL.
2011-01-06 14:39:40 +09:00
Tristan Van Berkom
aa787c9dd1 Fixed focus handling on embedded windows.
Now GtkWindow chains up in focus vfuncs when non-toplevel, this
fixes focus in testtoplevelembed.
2011-01-06 14:39:40 +09:00
Tristan Van Berkom
fdba9f281d Fixed issues with "hierarchy-changed" signal.
GtkFileChooserDefault watches the toplevel and montitors "set-focus"
signal on it... however the connection needs to be remade when the
GtkFileChooserDialog is in an embedded toplevel.

Measure's taken: GtkWindow propagates hierarchy changes when
_gtk_window_set_is_toplevel() is called, gtk_widget_unparent()
unsets the widget's parent window earlier in the function so that
the possible hierarchy change is still able to properly access the hierarchy.

GtkFileChooserDefault checks if the "new" toplevel is indeed
gtk_widget_is_toplevel() but not the old one, GtkRange has been
updated to use gtk_widget_is_toplevel() inside it's hierarhcy_changed
vfunc, other classes already do this properly.
2011-01-06 14:39:40 +09:00
Tristan Van Berkom
addcc64b9c Slightly less special casing in GtkWindow for gtk_widget_is_toplevel()
Also take care of setting the resize-mode at realize time depending
on toplevelness.
2011-01-06 14:39:40 +09:00
Tristan Van Berkom
8b4b62f00c Allow GtkWindow to be parented if gtk_widget_set_parent_window() is called on one
This patch makes gtk_widget_set_parent_window() undo the toplevelness
of a GtkWindow, GtkWindow then realizes itself as a normal child widget
and behaves like a normal GtkBin by checking gtk_widget_is_toplevel() in
several places (show/hide/map/unmap/draw/size_allocate/check_resize/configure_event).
2011-01-06 14:39:40 +09:00
Matthias Clasen
98440ad031 Remove gtktypeutils altogether
Based on patches by Javier Jardón.

https://bugzilla.gnome.org/show_bug.cgi?id=629955
2011-01-04 14:51:19 -05:00
Matthias Clasen
b5c6904c2f Drop explicit includes of gdkkeysyms.h
These are no longer needed. At the same time, port gtkimcontextsimpleseqs.h
to use the new GDK_KEY_ symbols.
2011-01-04 12:21:41 -05:00
Carlos Garnacho
badbef33ab GtkWindow: remove unneeded call
gtk_widget_style_attach() is no longer necessary.
2011-01-04 02:56:25 +01:00
Matthias Clasen
6a11c59290 Release GtkApplication earlier
GtkWindow was only releasing the application in finalize, causing
problems for language bindings. Now we release it already in destroy
(and then again in finalize for good measure).

https://bugzilla.gnome.org/show_bug.cgi?id=638580
2011-01-03 13:11:55 -05:00
Benjamin Otte
0c285341a9 API: gdk: gdk_display_get_device_state() => gdk_device_get_position()
The API was not display-specific, but belonged to the device. Also, we
didn't find a user of the modifier mask, so we dropped it.
2010-12-27 18:46:41 +01:00
Stef Walter
433a22cd11 Remove private header from gtkwindow.h
https://bugzilla.gnome.org/show_bug.cgi?id=637907
2010-12-23 19:23:48 -06:00
Matthias Clasen
2ed81aa57c Remove sealed members from GtkMenuShell 2010-12-23 18:21:53 -05:00
Matthias Clasen
3e08a23237 Drop long-obsolete linux framebuffer APIs
The functions to set frames on windows stopped being interesting
when the linux framebuffer port was dropped, many years ago.

Similar functionality may come back with client-side decorations
in the future.
2010-12-23 12:59:49 -05:00
Matthias Clasen
3a6800a898 Some small doc corrections 2010-12-23 11:18:50 -05:00
Benjamin Otte
8f1f743903 gtk: Use g_object_unref instead of gdk_cursor_unref 2010-12-21 12:07:05 -05:00
Havoc Pennington
b67c5af55b Add invariant that a child is unmapped if parent is unmapped
Requires fixes to GtkContainer and GtkWindow to unmap their
children, rather than just withdrawing or hiding the container
window.

Requires fix to GtkHandleBox to chain up to GtkContainer unmap.

Historically we avoided these unmaps for efficiency reasons,
but these days it's a bigger problem that there's no way
for child widgets to know that one of their ancestors has
become unmapped.
2010-12-20 12:58:04 -05:00
Carlos Garnacho
bbc637f7fd GtkWindow: remove deprecated call.
gtk_style_context_reset_widgets() can be used now to reset all widgets
in a screen.
2010-12-18 11:43:37 +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
Benjamin Otte
fc711434bc gtk: Remove old DirectFB code for drawing window decorations
I'm not sure it'd even compile.
2010-12-06 18:57:11 +01:00
Matthias Clasen
d9b0da5b83 Fix resize grip drawing
There was some confusion about junctions...
2010-12-04 15:39:34 +01:00
Carlos Garnacho
dc2df7d178 GtkWindow: Use GtkStyleContext for rendering. 2010-12-04 15:38:55 +01:00
Michael Natterer
fb5dd9f72f Move all GdkDevice members to private and add one missing accessor 2010-11-23 20:25:13 +01:00
Chun-wei Fan
76dc9e6b53 gtk: fix C99-style variable declarations in various sources 2010-11-10 10:08:14 +08:00
Cosimo Cecchi
f437507d4d gtkwindow: properly set the window icon list (#631331)
This was probably a rendering-cleanup regression.
2010-11-05 16:26:30 +01:00
Javier Jardón
a9894d4cf4 Use gtk_box_new() instead gtk_[v|h]box_new() 2010-10-30 05:22:58 +02:00
=Christian Persch
d3f1745493 Use g_ascii_strto[u]ll instead of strto[u]l
We don't want GtkBuilder input to be locale-dependent.

Bug #632503
2010-10-25 12:22:20 -04:00
Matthias Clasen
1be9b7f782 Some GtkApplication cleanups
Remove no-longer-needed vfuncs, no longer existing functions,
and improve the docs here and there.
2010-10-23 21:24:24 +02:00
Michael Natterer
c2f29f2cef gtk: clean up GtkWidget signals
- add slots for damage-event, move-focus and keynav-failed
- reorder signals a bit so related stuff is grouped together
- some indentation fixes in the GtkWidgetClass
- remove the move-focus compat hack from GtkTextView
- turn the move-focus compat hack in GtkWindow into properly
  implementing GtkWidget::move-focus()
2010-10-20 17:02:38 +02:00
Emmanuele Bassi
2cc059a0e7 Split off gtkprivate.h
The gtkprivate.h header contains GtkWidget-specific private symbols that
are not useful except in a handful of cases. Basically everything
includes gtkprivate.h for the GTK_PARAM_* macros.

https://bugzilla.gnome.org/show_bug.cgi?id=632539
2010-10-20 10:34:26 +01:00
Ryan Lortie
c5ebb61b6f GtkApplication: add gtk_application_get_windows()
Return a GList of the GtkWindow objects for each window that has the
application set as its "application" property.
2010-10-19 21:10:02 +02:00
Ryan Lortie
ab5fb5dee5 GtkApplication rewrite 2010-10-19 01:31:09 +02:00
Cody Russell
44cb3bcfed Implement style_set() for GtkWindow to resize window grips when the style changes. 2010-10-13 23:04:11 -05:00
Matthias Clasen
7d5a85c3ad Some more resize grip cleanups
Don't recompute hints whenever we determine the drag edge, and
take the drag edge into account when deciding whether to show
the grip.
2010-10-13 10:39:09 -04:00
Matthias Clasen
9e661ed0e9 Unify handling of GtkWindow::resizable property 2010-10-13 10:23:51 -04:00
Matthias Clasen
f8b8c95f45 Some resize grip cleanups
Safe space in the private struct, always set the cursor when we
update visibility, since the cursor depends on resizability conditions
too. And don't set the shape needlessly.
2010-10-13 09:51:54 -04:00
Matthias Clasen
5e1d8814ca Don't start a drag if we are not resizable
This was caused by get_drag_edge() returning -1 to mean 'no drag',
but callers didn't really pay attention. Change get_drag_edge()
to return a boolean instead.
2010-10-13 08:31:06 -04:00
Matthias Clasen
36f1d08bce Fix a trivial typo 2010-10-12 00:50:18 -04:00