Commit Graph

24550 Commits

Author SHA1 Message Date
Benjamin Otte
f706891dd3 widget: Refactor function
Turn it from a loop into tail-calling itself.
2015-10-28 19:44:28 +01:00
Benjamin Otte
ab7e901cfd widget: Move resize function into gtkwidget.c
There's no sizegroup specific code left in it, but lots of
widget-specifics.
2015-10-28 19:44:28 +01:00
Benjamin Otte
4fa74e68e9 sizegroup: Merge function into only caller 2015-10-28 19:44:28 +01:00
Benjamin Otte
b5dfe9b833 sizegroup: Simplify widget's size group invalidation
Since we do not queue resizes twice anymore, we can just walk the list
of groups without deduplication.
2015-10-28 19:44:28 +01:00
Benjamin Otte
a31123e9f0 sizegroup: Skip resizes on widgets that have resize queued
Widgets that already have a resize queued don't need to walk the whole
parent chain and queue another resize. It's enough to do it once per
resize.

This also means that sizegroups cannot use the shortcut of just
invalidating the first widget in the group anymore. That widget might
already have a resize queued while others don't.
2015-10-28 19:44:28 +01:00
Benjamin Otte
a4587ef4a0 widget: Warn on calls to queue_resize() during size_allocate()
This happens way too much, so it's disabled unless GTK_DEBUG=geometry is
on.

Also, we can't detect it in the call to queue_resize() yet, only during
size_allocate(), so the warning comes after the signal emission.
2015-10-28 19:44:28 +01:00
Benjamin Otte
4d631a9144 widget: Clear pending resizes after size_allocate()
This catches the cases where widgets call gtk_widget_queue_resize()
in their size_allocate() callback.
2015-10-28 19:44:28 +01:00
Benjamin Otte
3e3f17576e widget: Warn if size-unqueried widgets get allocated
Widgets should have gtk_widget_get_preferred_width/height() called
on them before gtk_widget_size_allocate() gets called.
Add a check for this.
2015-10-28 19:44:28 +01:00
Benjamin Otte
6cc2615b63 widget: Add a resize_needed flag
... and API to set and unset it.

It is set when gtk_widget_queue_resize() is called.
It is unset when gtk_widget_get_preferred_width/height() is called.

So far it is not used.
2015-10-28 19:44:28 +01:00
Benjamin Otte
3ff894c201 widget: Add a function that does actual resize
It's just shuffling code around.
2015-10-28 19:44:28 +01:00
Benjamin Otte
58d506fb11 sizegroup: Merge function into only caller
Both functions were running the same loop. Just running the loop once
seems advantageous.
2015-10-28 19:44:28 +01:00
Benjamin Otte
85ab8ad001 sizegroup: Don't invalidate over resize containers.
Before this commit, a widget tree like this:
  Window
    AnyContainer (part of SizeGroup1)
      GtkClutterEmbed
        SomeWidget
when calling gtk_widget_queue_resize(SomeWidget), would invalidate
SizeGroup1, when it should have stopped at the GtkClutterEmbed (which is
a RESIZE_IMMEDIATE child).
2015-10-28 19:44:28 +01:00
Benjamin Otte
1f2e21ab9a sizegroup: Refactor function
Get rid of continues in loop. This allows doing more complex things in
future commits.
2015-10-28 19:44:27 +01:00
Benjamin Otte
0721d964e4 sizegroup: Refactor function 2015-10-28 19:44:27 +01:00
Benjamin Otte
dd0e5cfce6 sizegroup: Remove special case before loop
The loop actually does the right thing already. There's no need to
complicate things.
2015-10-28 19:44:27 +01:00
Benjamin Otte
8fea3b02c9 sizegroup: refactor
The code looks a lot less dangerous if it doesn't look like we're
casting a random widget to a container.
2015-10-28 19:44:27 +01:00
Benjamin Otte
e19818359a sizegroup: Fold function into only caller 2015-10-28 19:44:27 +01:00
Benjamin Otte
690e015ed1 sizegroup: Move container function into its only caller 2015-10-28 19:44:27 +01:00
Benjamin Otte
0912a6c2f5 widget: Use gtk_widget_queue_allocate() when clip changes
There's no need to queue a full resize there.
2015-10-28 19:44:27 +01:00
Benjamin Otte
195397e87a API: widget: Add gtk_widget_queue_allocate()
This is so widgets can queue a rerun of their allocation logic, but
without triggering resizes everywhere.

For now, it just calls gtk_widget_queue_resize().
2015-10-28 19:44:27 +01:00
Benjamin Otte
798a288405 container: Use correct allocation for calling size_allocate() 2015-10-28 19:44:27 +01:00
Benjamin Otte
d3d9f52365 API: widget: Add gtk_widget_get_allocated_size()
See docs for what this is.
2015-10-28 19:44:27 +01:00
Benjamin Otte
ab2d236d3d sizegroup: Remove GtkQueueResizeFlags
They were only used with geometry widgets.
2015-10-28 19:44:27 +01:00
Benjamin Otte
5dd2087d19 widget: Remove _gtk_widget_override_size_request()
The function was only used by the geometry widget.
2015-10-28 19:44:27 +01:00
Benjamin Otte
08974a1e9a window: Ignore geometry widget
Ignore the geometry widget passed to gtk_window_set_geometry_hints().
Usind the widget itself was a hack that complicates the size request
machinery.

It is also incorrect in that it doesn't respect height-for-width.

Last but not least, it was only used by gnome-terminal and that
application can easily work without it.
2015-10-28 19:44:27 +01:00
Benjamin Otte
e422ccefe1 container: Don't randomly call gtk_widget_set_allocation()
gtk_widget_size_allocate() does that already.
2015-10-28 19:44:27 +01:00
Benjamin Otte
624fb8b360 entry: Always render like with is_cellrenderer
And remove the API to set that variable.
If you want the entry to not fill its whole allocated area,
  gtk_widget_set_valign (entry, GTK_ALIGN_FILL);
will give you the old behavior.
2015-10-28 19:44:26 +01:00
Benjamin Otte
8ec2362d81 icontheme: Clarify GENERIC_FALLBACK flag handling
- Add docs explaining that it doesn't work everywhere
- g_warn_if_fail() in the APIs where it doesn't work
2015-10-28 19:44:26 +01:00
Benjamin Otte
5cffbed165 iconhelper: Don't pass GENERIC_FALLBACK flag
It's not used when looking up with a GIcon.
2015-10-28 19:44:26 +01:00
Benjamin Otte
a58d8bdcbc cssprovider: Have a section when parsing style properties
Signal handlers expect a section to be present, so provide them with
one.

New testcase included.

https://bugzilla.gnome.org/show_bug.cgi?id=757240
2015-10-28 19:37:27 +01:00
Matthias Clasen
c4eb14eb01 Revert "tooltip: Use an element name"
This reverts commit efc8dc63e3.

This change broke tooltip positioning in a way that I don't
fully understand, so take it back for now.
2015-10-28 11:53:36 -04:00
Matthias Clasen
854c7d1f0f Revert "HighContrast: Update tooltip styling"
This reverts commit 93d80380ee.
2015-10-28 11:53:33 -04:00
Matthias Clasen
cab40f0743 Revert "Adwaita: Update tooltip theming"
This reverts commit d974610741.
2015-10-28 11:48:52 -04:00
Matthias Clasen
b4d49c36ce Fix key themes for GtkEntry -> entry
This was pointed out in

https://bugzilla.gnome.org/show_bug.cgi?id=757252
2015-10-28 10:19:00 -04:00
Matthias Clasen
20e46ce8ae shortcuts: Redo the stack switcher theming
Use style classes on the button instead of the stack switcher,
this makes it easier to reuse elsewhere.
2015-10-28 10:19:00 -04:00
Matthias Clasen
62ec4a2415 shortcuts label: Redo the keycap theming
Use a style class directly on the frame. This is easier to reuse.
2015-10-28 10:19:00 -04:00
Matthias Clasen
4e950da4d1 Adwaita: Update shortcuts window theming
Use the newly added element name.
2015-10-28 10:19:00 -04:00
Matthias Clasen
0dffc8c9d3 shortcuts: Use predefined style classes
Lets use the defines we have.
2015-10-28 07:10:55 -04:00
Matthias Clasen
b3619f9050 HighContrast: Update calendar theming
Use the newly introduced element name instead of hardcoding the type.
2015-10-28 06:45:37 -04:00
Matthias Clasen
085edf0212 Adwaita: Update calendar theming
Use the newly introduced element name instead of hardcoding the type.
2015-10-28 06:45:25 -04:00
Matthias Clasen
2c2fd5c8c5 calendar: Add an element name
This will allow us to drop hardcoded type names in the theme.
2015-10-28 06:35:33 -04:00
Matthias Clasen
37eb5c08a4 inspector: Cosmetic changes to the hierarchy tab
Put the interfaces below GInterface.
2015-10-28 00:41:13 -04:00
Matthias Clasen
3869bdbc2b inspector: Add css node style properties
Add a per-cssnode view of style properties.
2015-10-28 00:33:14 -04:00
Matthias Clasen
0d8444d067 Drop some no-longer existing headers 2015-10-27 20:29:43 -04:00
Matthias Clasen
93d80380ee HighContrast: Update tooltip styling
Use the newly added element name instead of hardcoding the type.
2015-10-27 20:06:24 -04:00
Matthias Clasen
d974610741 Adwaita: Update tooltip theming
Use the newly introduced element name instead of hardcoding the type.
2015-10-27 20:06:24 -04:00
Matthias Clasen
efc8dc63e3 tooltip: Use an element name
This will allow us to drop hardcoded type names in the theme.
2015-10-27 20:06:24 -04:00
Benjamin Otte
e3ddbc544c cssselector: Print name and any selector first
When printing a "compound selector", make sure the name and universal
selectors are printed at the beginning and class, id, etc. selectors are
printed last.
2015-10-27 20:12:38 +01:00
Matthias Clasen
9848fe006e Adwaita: Update GtkAssistant theming
Use the new element name, instead of hardcoding the type.
2015-10-27 14:37:58 -04:00
Matthias Clasen
5b0208f890 assistant: Use an element name
This will allow us to drop hardcoded type names in the theme.
2015-10-27 14:37:58 -04:00
Matthias Clasen
0f4663728e toolitemgroup: Fix the previous change
dispose can be called more than once.
2015-10-27 12:54:19 -04:00
Matthias Clasen
9753bea6a4 tool item group: Don't leak a button
This causes a hickup in the new css node machinery, causing
the default-value test to fail.
2015-10-27 11:09:00 -04:00
Matthias Clasen
270e900f55 icon theme: Ensure to propagate an error
If the svg pixbuf loader is not available, we end up with criticals
from gtk_css_image_icon_theme_draw because gtk_icon_info_load_symbolic
returns NULL without setting an error.

Avoid this by propagating the load error.
2015-10-27 11:09:00 -04:00
Matthias Clasen
bb5b711d4b shortcuts: Some property hygiene
Bring property notification for some of the new shortcuts widgets
up to the standards of our testsuite.
2015-10-27 09:25:17 -04:00
Matthias Clasen
ed00d86496 inspector: Allow editing css node properties
This reuses the property editor infrastructure from the
property list pages. Good that css nodes are objects.
2015-10-26 23:39:51 -04:00
Matthias Clasen
6852a1eef9 inspector: Support editing interned string properties
Sadly, interned string properties cannot be handled generically
at all - GObject insists on inserting a strcpy in any attempt
to set a string property with generic api, destroying the
internedness of the string.

Therefore, we have to special-case GtkCssNode in the property
editor code :-(
2015-10-26 23:39:51 -04:00
Matthias Clasen
b7d001e613 Add some api annotations
Nothing is using the /*interned*/ annotations currently,
but if we are doing this, we should be consistent.
2015-10-26 23:39:50 -04:00
Benjamin Otte
a648afae12 widget: Add name to widget paths
This changes widget paths for widgets with a CSS name to return that CSS
name, now that we have added API for it.
This means that style properties are now matches using the CSS name.

Also fix the theme to use the correct name when matching style properties.
2015-10-27 03:13:42 +01:00
Benjamin Otte
517cea36ed cssmatcher: Actually match names for widget paths
The type is always 0 when we use names. So this would always return
FALSE. Oops.
2015-10-27 03:13:42 +01:00
Matthias Clasen
d717afd4d4 entry: properly update css subnode state
Update the state of the css subnodes for icons when
appropriate, and avoid calling set_state after save_to_node.
2015-10-26 22:09:07 -04:00
Matthias Clasen
c72d094ae0 entry: Use better element name for progress
Change the name of the CSS subnode for progress rendering from
progressbar to progress. This will align better with GtkProgressBar.
2015-10-26 21:34:16 -04:00
Robert Ancell
aefa1ba611 gdk: Deprecate gdk_display_get_screen 2015-10-27 14:17:52 +13:00
Benjamin Otte
101df329ae API: Add gtk_widget_path_iter_set_object_name()
... and gtk_widget_path_iter_get_object_name(). This allows applications
that still use widget paths to use the new object names to get the
correct styling.

Mutter and webkit-gtk are examples here.
2015-10-27 01:44:50 +01:00
Jonas Ådahl
aedd193c69 GtkTreeView: Rework the search window hack so it also works on Wayland
The search window of a tree view was implemented by showing without
making it visible by by positioning it outside the screen edge. This is
not possible on Wayland, so implement another method for being able to
enter text into a non-visible entry.

The new method is implemented by, before showing the window, pass the
key event directly to the IM context backing the entry. If the key
event triggered the context to commit new text or change the preedit
content, the search window is shown, and from that point the key events
are forwarded directly to the entry widget.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Jonas Ådahl
97dbef451e GtkTreeView: Make a search window destroy helper
https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Jonas Ådahl
2eb7d7476b GtkTreeView: Use more consistent search window naming
Instead of alternating between search dialog and search window, use
search window everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Matthias Clasen
76619cf1ae entry: Bring back icon padding
Not sure why this is necessary now, but it is.
2015-10-26 16:51:28 -04:00
Matthias Clasen
ed8641ff26 entry: Only set one of the .left, .right style classes
We were not removing the old style class when adding a new one.
2015-10-26 15:28:50 -04:00
Matthias Clasen
e28b3d1296 assistant: Handle page-type and title changes properly
We need to update our state when a pages' type or title changes.
2015-10-26 09:01:07 -04:00
Matthias Clasen
6efbf329c3 shortcuts: Cosmetic change
The .flat style class is controlled by the relief property,
so just use that instead of manually setting style classes.
2015-10-26 07:23:07 -04:00
Matthias Clasen
953aa45c04 label docs: Mention common style classes
Mention some of the style classes that are commonly used
with labels.
2015-10-26 07:23:07 -04:00
Olivier Fourdan
305b34aa15 GtkWindow: fix move/get position with CSD
Take into account and compensate for the size of the client side
decorations widgets in gtk_window_move() and gtk_window_get_pos()
including gravity.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756618
2015-10-26 08:40:36 +01:00
Olivier Fourdan
3450f53907 GtkWindow: add up CSD size in gtk_window_resize()
When client side decoration is used, the size passed to
gtk_window_resize() or retrieved from gtk_window_get_size() for top-
level windows also accounts for the client side decorations widgets
such as the title bar or the shadow borders.

Add up the size of these additional controls to the given size to get
the size expected.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756618
2015-10-26 08:40:36 +01:00
Matthias Clasen
bf65b06781 HighContrast: Don't use GtkInfoBar type name
We have a proper element name for it now.
2015-10-25 17:19:34 -04:00
Matthias Clasen
91ec104dd3 Adwaita: Don't use GtkInfoBar type name
We have a proper element name for it now.
2015-10-25 17:19:01 -04:00
Matthias Clasen
f1248ccea4 infobar: Add a name to the css node
This lets us avoid the type name in css.
2015-10-25 17:18:20 -04:00
Matthias Clasen
2de0f06af9 HighContrast: Update separator rendering
Adapt HighContrast t othe changes in the pre-previous commit.
2015-10-25 16:29:11 -04:00
Matthias Clasen
0ba03aac16 Adwaita: Update separator styling
Adapt Adwaita to the changes in the previous commit.
2015-10-25 16:28:38 -04:00
Matthias Clasen
2eb6599b29 separator: Use the element name separator
Switch GtkSeparator from using the .separator style class to
using the element name separator for its css node.
2015-10-25 16:27:44 -04:00
Matthias Clasen
aa67ad0011 Adwaita: Update accel label styling
Adapt Adwaita to the changes in the previous commit.
2015-10-25 15:45:13 -04:00
Matthias Clasen
caa6fb0732 accel label: Use a css node for the accelerator
Use a permanent subnode with name accelerator instead of the
.accelerator style class.
2015-10-25 15:45:13 -04:00
Matthias Clasen
2b20bd54c5 HighContrast: Update spinner rendering
Adapt HighContrast to the changes in the pre-previous commit.
2015-10-25 15:45:13 -04:00
Matthias Clasen
bd80b1d037 Adwaita: Update spinner styling
Adapt Adwaita to the changes in the previous commit.
2015-10-25 15:45:13 -04:00
Matthias Clasen
9269525f07 spinner: Use the element name spinner
Switch GtkSpinner from using the .spinner style class to
using the element name spinner for its css node.
2015-10-25 15:45:13 -04:00
Matthias Clasen
f55e3f7eda inspector: Be more careful with dead objects
gtk_inspector_object_tree_find_object accesses the type information
of the object, so we can't safely use it on an already decaying
object when we get a weak notify. Instead just walk the tree and
compare pointers, that is safe.

https://bugzilla.gnome.org/show_bug.cgi?id=756852
2015-10-25 13:11:17 -04:00
Matthias Clasen
4305aa1def inspector: Improve css node UI
All the other object pages have a title, this one was missing it.
Add one, so the page fits in with the rest.
2015-10-25 09:20:43 -04:00
Matthias Clasen
1e112ca75e inspector: Allow editing strv-valued properties
These do occur in some places, and we can easily allow editing
them.
2015-10-25 02:14:04 -04:00
Matthias Clasen
e440050134 Fix the build 2015-10-24 17:04:38 -04:00
Matthias Clasen
f1b7560938 notebook: Document css nodes and style class
This will have to be updates as we do further changes to the
way GtkNotebook does its rendering.
2015-10-24 10:54:56 -04:00
Matthias Clasen
8917ee5373 notebook: Drop unneeded code
We no longer need to set the position classes on the main css node,
since they are already set on the per-tab subnodes.
2015-10-24 10:39:18 -04:00
Matthias Clasen
9f738da11b HighContrast: Update notebook styling
The switch from .notebook to notebook requires minor changes,
such as moving the style properties into a separate selector.
2015-10-24 10:39:18 -04:00
Matthias Clasen
a22e07f374 Adwaita: Update notebook styling
The switch from .notebook to notebook requires minor changes,
such as moving the style properties into a separate selector.
2015-10-24 10:39:18 -04:00
Matthias Clasen
f194b9608a notebook: Use the element name notebook
Switch GtkNotebook from using the .notebook style class to
using the element name notebook for its main css node.
2015-10-24 10:39:18 -04:00
Matthias Clasen
e2bfe9e95a notebook: Cosmetic cleanup 2015-10-24 10:39:17 -04:00
Matthias Clasen
431089f769 entry: Add css node documentation
List the css names and the typical style classes that can be
expected to occur with entries.
2015-10-23 16:22:25 -04:00
Matthias Clasen
78309d8b00 HighContrast: Update entry progress rendering
Adapt HighContrast to the changes in the pre-previous commit.
2015-10-23 16:16:55 -04:00
Matthias Clasen
d8a3a4e7aa Adwaita: Update entry progress rendering
Adapt Adwaita to the changes in the previous commit.
2015-10-23 16:13:43 -04:00
Matthias Clasen
6a768ba218 entry: Use a permanent css node for progress
Create a css node with name progressbar when we start showing progress
in the entry. The node gets the style class .pulse added when we
do pulse mode.
2015-10-23 16:11:08 -04:00
Matthias Clasen
e39ca899ad Adwaita: Update for entry icon changes 2015-10-23 15:41:05 -04:00
Matthias Clasen
f5e77d0c67 entry: Use css nodes for icons
Create css nodes for icons in entries, with name image, and use
gtk_style_context_save_to_node() for them. We still set the
style classes .left and .right on them.
2015-10-23 15:39:29 -04:00
Matthias Clasen
8a8518ed40 HighContrast: Update entry styling
Use the new element name instead of the style class.
2015-10-23 14:53:06 -04:00
Matthias Clasen
c6a7ceedc9 Adwaita: Update entry styling
Use the new element name instead of the style class.
There is some minor fallout for vertical spin buttons that
will need a second look.
2015-10-23 14:52:27 -04:00
Matthias Clasen
b2dd9cbc59 entry: Use the element name entry
Set the element name on the css node and drop the .entry class.
2015-10-23 14:51:35 -04:00
Lapo Calamandrei
5b0a26f8a3 Adwaita: fix switch styling
looks like switch stare are not passed to the slider anymore so
rewrite selectors accordingly.
2015-10-23 17:12:01 +02:00
Lapo Calamandrei
4959fe3267 Adwaita: generalize .has-open-popup
so it works for any list-row istead of just the ones in a sidebar.
2015-10-23 16:58:17 +02:00
Matthias Clasen
71b79f3329 shortcut: Improve formatting of ranges
Use a centered ellipsis, to make it look nicer.
2015-10-23 07:46:31 -04:00
Matthias Clasen
57057f73e4 HighContrast: Update image styling
Use the new element name instead of the type name.
2015-10-23 00:05:46 -04:00
Matthias Clasen
6f90b3ca31 Adwaita: Update image styling
Use the new element name instead of the type name.
2015-10-23 00:05:18 -04:00
Matthias Clasen
34be4de1ad image: Use the element name image
Set hte element name on the CSS node.
2015-10-23 00:04:47 -04:00
Matthias Clasen
a8b5c04694 HighContrast: Update label styling
Use the new element name instead of the style class.
2015-10-22 23:27:43 -04:00
Matthias Clasen
bacc9d4edd Adwaita: Update label styling
Use the new element name instead of the style class.
2015-10-22 23:27:43 -04:00
Matthias Clasen
7d98c7f1ae label: Use the element name label
Set the element name on the CSS node, and drop the .label style
class.
2015-10-22 23:27:43 -04:00
Matthias Clasen
506d5b5b48 switch: Document css names a bit
This is still provisional. Better gtk-doc support will be needed
to do better here.
2015-10-22 23:27:43 -04:00
Matthias Clasen
b5e1fd5b7f HighContrast: Update switch styling
Use the new element names instead of the type name and style
classes, just like we did for Adwaita in the previous commit.
2015-10-22 21:44:03 -04:00
Matthias Clasen
99d7648517 Adwaita: Update switch styling
Use the new element names instead of the type name and style
classes.

Note that there is one problem with moving away from type names
here: it turns out that style properties only work if the selector
uses the type name.
2015-10-22 21:42:20 -04:00
Matthias Clasen
48b30e8e91 switch: Convert to element names
Use the element names switch and slider for the two css nodes,
and drop the .trough and .slider classes.
2015-10-22 21:40:31 -04:00
Matthias Clasen
203742b188 widget: Always set the type on css nodes
See the previous commit for why this is necessary.

Also make gtk_widget_class_set_css_name work by looking at
the correct class for the name.

Note for future reference: GTK_WIDGET_GET_CLASS() does not
work in the instance init function.
2015-10-22 21:01:06 -04:00
Matthias Clasen
d1a85fc9e4 css node declaration: Allow both name and type to be set
The widget path machinery assumes that we always have types,
and without this change, it will start spewing warnings when
we start to introduce node names.
2015-10-22 20:58:52 -04:00
Matthias Clasen
e0d9250a07 inspector: Show names for css nodes
Currently, we don't have any css nodes with names, but we will soon.
2015-10-22 20:58:08 -04:00
Matthias Clasen
7cf3eec85b Add since tags to new api
gtk_widget_class_set/get_css_name were missing it.
2015-10-22 19:43:32 -04:00
Timm Bäder
5a0a870d89 GtkApplicationWindow: Add missing annotations 2015-10-22 21:02:28 +02:00
Matthias Clasen
67a54bf4ef shortcuts: Support ranges in the display of shortcuts
Repeating Alt-1 to Alt-9 as individual shortcuts looks really boring,
so allow compressing such ranges by specifying <Alt>1...9.
2015-10-22 14:32:50 -04:00
Benjamin Otte
6cf7c03334 notebook: On drag window hide, fix css nodes 2015-10-22 20:29:10 +02:00
Benjamin Otte
1f1c7547da switch: Use the right state when querying padding
We were using the state of the widget node, not the state of the slider
node.

This caused layout loops due to invalidations.
2015-10-22 18:43:55 +02:00
Owen W. Taylor
1571d2872f GtkWindow: draw the frame and shadow even for app-paintable windows
If a window is decorated, we need to draw the frame and shadow, even if
it is app-paintable - it's just nonsense to have a frame that we handle
events on, but expect the app to paint it. (We paint the titlebar in
any case.) If a client wants to handle all painting, it should use an
undecorated window.

https://bugzilla.gnome.org/show_bug.cgi?id=756886
2015-10-22 11:05:03 -04:00
Owen W. Taylor
01136618b8 Guard against selection requestor disappearing
We made a number of unchecked accesses to the selection requestor,
which could cause X errors if the selection requestor vanished
(or we were sent invalid events). Add error traps around all of them.

See https://bugzilla.redhat.com/show_bug.cgi?id=1210814 for an
example of a crash that could be caused by this. (There are about
1000 instances of such a crash in http://retrace.fedoraproject.org
though no linked bug reports specifically talk about cut-and-paste
or DND.)

https://bugzilla.gnome.org/show_bug.cgi?id=756881
2015-10-22 11:05:03 -04:00
Benjamin Otte
d3bf602c60 iconcache: Remove unused function 2015-10-22 16:42:49 +02:00
Benjamin Otte
371f501632 window: Name the decoration style 2015-10-22 16:42:48 +02:00
Benjamin Otte
408920d438 window: Add gtk_widget_class_set_css_name()
This is to replace using class names as CSS names.
2015-10-22 16:42:48 +02:00
Benjamin Otte
244d9ffeee window: Refactor function
Move gtk_style_context_save() into the function that sets up the
decoration rendering.
2015-10-22 16:42:48 +02:00
Benjamin Otte
ed574408f2 notebook: Remove "prelight-page" class
Instead, just use the "tab:hover" selector
2015-10-22 16:42:48 +02:00
Benjamin Otte
182f9a7f39 notebook: Remove "active-page" class
Instead, just use the "tab:active" selector
2015-10-22 16:42:48 +02:00
Benjamin Otte
2720d97db3 notebook: Remove funciton by folding it into callers 2015-10-22 16:42:48 +02:00
Benjamin Otte
acd63a6019 notebook: Refactor internal function
Don't return the state anymore as the function doesn't even look at the
state. Instead, make the callers that need the state query it manually.
2015-10-22 16:42:48 +02:00
Benjamin Otte
7b9844288a notebook: Make tab positions permanent
... on the tab CssNodes.
2015-10-22 16:42:48 +02:00
Benjamin Otte
dd3f2ec987 notebook: Remove last traces of regions
Now that we don't use regions anymore, there's no need to update
anything when the regions change.
2015-10-22 16:42:47 +02:00
Benjamin Otte
f713bcd742 notebook: Set reorderable-page style class properly
Set it when the reorderable state changes, not just when rendering.
2015-10-22 16:42:47 +02:00
Benjamin Otte
a4e86341e4 notebook: Set active state properly
Don't update it on save/restore, actually set it when it changes.
2015-10-22 16:42:47 +02:00
Benjamin Otte
541926089a notebook: Set prelight state properly
Don't update it on save/restore, actually set it when it changes.
2015-10-22 16:42:47 +02:00
Benjamin Otte
3392d53f61 notebook: Use CssNodes instead of regions
This almost makes CSS work again with notebooks.
2015-10-22 16:42:47 +02:00
Benjamin Otte
01f7711307 notebook: Move style_context_save() into function
This is for future changes.
2015-10-22 16:42:47 +02:00
Benjamin Otte
601fe8f502 css: Remove macros that were used only with regions 2015-10-22 16:42:47 +02:00
Benjamin Otte
55d496e917 cssmatcher: Remove matching API for regions 2015-10-22 16:42:47 +02:00
Benjamin Otte
983de6f4a0 treeview: Use a cssnode instead of regions
This makes Treeview headers work again like before region support was
removed.
2015-10-22 16:42:47 +02:00
Benjamin Otte
24dde6346a API: cssselector: Stop supporting regions
The namespace that belonged to regions is supposed to be used for
CssNode names.
2015-10-22 16:42:46 +02:00
Benjamin Otte
20ce0588b1 treeviewcolumn: Create button on init
This way, the button is always available and the code doesn't have to
special case this condition.
2015-10-22 16:42:46 +02:00
Benjamin Otte
950b1fb65c switch: Port to GtkCssNode
This is a simple port, no code modifications so far other than replacing
gtk_style_context_save() with gtk_style_context_save_to_node().
2015-10-22 16:42:46 +02:00
Benjamin Otte
c075c14bf4 stylecontext: Add gtk_style_context_save_to_node()
To be used instead of gtk_style_context_save() with persistent nodes.
2015-10-22 16:35:14 +02:00
Benjamin Otte
72615a1b16 stylecontext: Add gtk_style_context_add_named()
This is an intermediate step for cssnode introduction. It gives a name
for the node created by saving the style context.
2015-10-22 16:35:14 +02:00
Benjamin Otte
385fda80b4 cssmatcher: Marshal name to matcher
... and use it in the node matcher.

Also rename function from _gtk_css_matcher_get_type() to
_gtk_css_matcher_get_name().
2015-10-22 16:35:14 +02:00
Benjamin Otte
efff9c8edb cssnode: Add setters/getters for name 2015-10-22 16:35:14 +02:00
Benjamin Otte
26450a661e cssnodedeclaration: Add possibility to set the name
This is supposed to be a replacement for setting the type. So far, both
options are possible - either will unset the other.
2015-10-22 16:35:14 +02:00
Benjamin Otte
b65f400d56 treeview: Remove "row" and "col" regions
They aren't used by the theme and we want to get rid of regions.
2015-10-22 16:35:13 +02:00
Matthias Clasen
f6d9f9f93d Add automatic help overlay support to GtkApplication
When the $(resource_prefix)/gtk/help-overlay.ui resource exists,
load a GtkShortcutsWindow from it for each GtkApplicationWindow,
and set up a win.show-help-overlay action with accels <Primary>F1
and <Primary>? to show it.
2015-10-21 15:33:09 -04:00
Matthias Clasen
d1c81446d7 Add some styling for GtkShortcutsWindow
Add some keycap frame around keysyms, and make the stack switcher
buttons rounds. This is very provisional.
2015-10-21 15:32:33 -04:00
Matthias Clasen
1dfbae1aa4 Add GtkShortcutsWindow
This is a toplevel window that is tailored towards showing
help for shortcuts in an application. The implementation closely
follows this design: https://wiki.gnome.org/Design/OS/HelpOverlay

This implementation is inspired by earlier work in gnome-builder,
thanks to Christian Hergert.

https://bugzilla.gnome.org/show_bug.cgi?id=756428
2015-10-21 15:19:34 -04:00
Matthias Clasen
f254a4b67f builder: Support creating GFile objects
This is useful, e.g. when creating GFileIcon objects.
2015-10-21 13:42:15 -04:00
Matthias Clasen
2dc63dad34 Don't use g_slist_next in gtktreeview.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
05717fe2df Don't use g_slist_next in gtktreemodel.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
95c7a539bf Don't use g_slist_next in gtktextview.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
55bd936b73 Don't use g_slist_next in gtktextlayout.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
b65668a251 Don't use g_slist_next in gtktextdisplay.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
060948d806 Don't use g_slist_next in gtktextchild.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
5dd78f74e0 Don't use g_slist_next in gtktextbufferrichtext.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
50c269f846 Don't use g_slist_next in gtktextbuffer.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
a863b06576 Don't use g_slist_next in gtkstock.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
9727a4c4bf Don't use g_slist_next in gtkiconfactory.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
b5d3bebae3 Don't use g_list_next in gtkselection.c
We generally access ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
ea91670c11 Don't use g_list_next in gtkmain.c
We generally access ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
8422633311 Don't use g_list_next in gtkdialog.c
We generall access ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
b84797a2c6 Don't use g_list_next in gtkcontainer.c
We generally access ->next directory.
2015-10-20 06:14:57 -04:00
Matthias Clasen
a0379d5424 Don't use g_slist_next in gtktextbtree.c
We generally access ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
d0e30994d0 builder: Don't use g_slist_next
We just use direct access to list->next all over the place.
2015-10-20 06:14:57 -04:00
Matthias Clasen
45fa145034 builder: Cosmetic changes
Use an iter instead of g_hash_table_forall.
2015-10-20 06:14:57 -04:00
Matthias Clasen
eec75ee9d6 Cosmetic changes
Line up struct-filling code with the order in the declaration.
2015-10-20 06:14:57 -04:00
Matthias Clasen
019078364e builder: Avoid some unnecessary overhead
Only get the class once per object, not once per property.
And don't canonicalize the property name, g_object_class_find_property
does that already.
2015-10-20 06:14:57 -04:00
Paolo Borelli
4447cf2419 widget: fix typo in warning message 2015-10-19 11:42:39 +02:00
Timm Bäder
944ef8bb0b GtkPaned: Fix gtk_paned_set_child_visible calls
Use CHILD1/CHILD2 instead of 0 and 1, always use the same order and
don't check for child NULL-ness, because it will be done in
gtk_paned_set_child_visible anyways.
2015-10-16 15:07:53 +02:00
Timm Bäder
d0779db1e1 GtkRevealer: Remove useless _start_animation call
The call just passed priv->target_pos, but _start_animation directly
returns if the given target is priv->target_pos (see line 627).
2015-10-16 15:07:49 +02:00
Sébastien Wilmet
9d3e9c9375 inspector: remove gtk_text_buffer_get_iter_at_line_index() workaround
The function is now safe to use.

https://bugzilla.gnome.org/show_bug.cgi?id=735341
2015-10-16 08:43:27 +02:00
Sébastien Wilmet
a9a1c00cc9 textbuffer: nicer get_iter functions
Avoid crashes when passing an invalid location to a
gtk_text_buffer_get_iter_at_*() function.

A boolean is returned to know if @iter has been set to the exact
location.

Unit tests are added.

https://bugzilla.gnome.org/show_bug.cgi?id=735341
2015-10-16 08:43:27 +02:00
Matthias Clasen
c264cd6785 Split off a private header for GtkTextBuffer
This avoids polluting the installed header with private symbols.
2015-10-15 23:04:44 -04:00
Matthias Clasen
3c217e6954 file chooser: Avoid search interruption
When the search entry is shown, the 'special' nature of
., ~ and / should not trigger the location entry, because
that interrupts the search and is likely not what the
user intended.

https://bugzilla.gnome.org/show_bug.cgi?id=756505
2015-10-15 20:53:43 -04:00
Matthias Clasen
0731c50262 entry completion: Only grab the device if we have one
When the entry completion is popped up from a timeout, we may
not have a device. In that case, don't call gdk_device_grab,
do avoid criticals.
2015-10-15 20:18:26 -04:00
Matthias Clasen
dd3f4f2904 scrolled window: Protect against nameless devices
It seems that gdk_device_get_name() can return NULL.
We should not crash if that happens.

https://bugzilla.gnome.org/show_bug.cgi?id=756625
2015-10-15 16:06:15 -04:00
Carlos Soriano
c3686838ea gtkplacesview: align spinner with header label
Use the box margin top instead of the label margin top,
so the spinner remains aligned with the header label.

https://bugzilla.gnome.org/show_bug.cgi?id=756568
2015-10-15 19:22:40 +02:00
Carlos Soriano
9cc3e63045 gtkplacesview: plug leak
https://bugzilla.gnome.org/show_bug.cgi?id=756568
2015-10-15 19:22:40 +02:00
Carlos Soriano
d29d54a97b gtkplacesview: remove hover color from rows
Since other views are not using hover neither

https://bugzilla.gnome.org/show_bug.cgi?id=756568
2015-10-15 19:18:54 +02:00
Carlos Soriano
9341f64c19 gtkplacesview: add a clear button to address entry
So it allows a quick way to clear the entry.

https://bugzilla.gnome.org/show_bug.cgi?id=756568
2015-10-15 19:18:54 +02:00
Carlos Soriano
f9b6c07c8a gtkplacesview: rotate server list icon on toggled
Disclosure triangles are usually used pointing down, however
in this case the popover spawns in the upper direction, which
makes it odd looking.
Instead of pointing always down or up, point down when not toggled and
animate a rotation when toggled.

https://bugzilla.gnome.org/show_bug.cgi?id=756568
2015-10-15 19:18:54 +02:00
Carlos Soriano
831509f6aa gtkplacesview: tweak ui to allow more server rows
Following design guidance, reduce row height and increase
popover height so the user is allowed to see more than 3
rows.

https://bugzilla.gnome.org/show_bug.cgi?id=756568
2015-10-15 19:18:54 +02:00
Carlos Soriano
1dbcce785e gtkplacesview: improve heuristics for external drives
Following the sidebar on commit b0989b190df, improve the way
we check when a drive is external or not.

https://bugzilla.gnome.org/show_bug.cgi?id=756589
2015-10-15 19:16:56 +02:00
Carlos Soriano
569be9f111 gtkplacesview: remove dead code
This is checked on add_volume inside the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=756589
2015-10-15 19:16:56 +02:00
Carlos Soriano
983c61826b gtkplacesview: remove dead code
This is checked on is_removable_volume

https://bugzilla.gnome.org/show_bug.cgi?id=756589
2015-10-15 19:16:56 +02:00
Carlos Soriano
0cd4e7ec43 gtkplacessidebar: improve heuristics for external drives
Since the change to use GtkPlacesView we don't want to show
internal storage on the sidebar.

In our case we were checking for drive_can_eject and
drive_is_media_removable.

However for some external hard drives it's reported that they
are not ejectable nor the have removable media. So the only
attribute that they have different from internal drives is that
they can be stopped.
So check for if the drive can be stopped to decide if it is
external or internal.

On the way realized we don't need to check for the mounts associated
with the volume to know if the volume can be ejected or not. So remove
that code.

https://bugzilla.gnome.org/show_bug.cgi?id=756589
2015-10-15 19:16:56 +02:00
Carlos Garnacho
8147f12eca texthandle: Ensure handles are invalidated on mode changes
Otherwise the "cursor" handle stays with "cursor" appearance instead of
"selection end" when a text selection is started.
2015-10-14 18:44:34 +02:00
Carlos Garnacho
14dde08e33 texthandle: small refactor
These long enums are used too often, shorten things a bit with temp vars.
2015-10-14 18:44:34 +02:00
Carlos Garnacho
cfaa421433 texthandle: Fix Y positioning of text handles
It is assumed that border.top is the same than pointing_to.height (which
equals the strong cursor position), which is not since some time ago.

The border calculation has been move on top too, it is now used in the
Y position one, and doesn't depend on anything we calculate later.
2015-10-14 18:44:34 +02:00
Carlos Garnacho
73bf16b3b0 texthandle: Fix handle dragging on wayland
Text handles are subsurfaces on wayland, so sort of their own toplevel.
This made gtk_widget_translate_coordinates() to bail out there, resulting
in text handles being mispositioned and jumpy. To fix this, translate to
toplevel GtkWindow coordinates manually, and translate coordinates from
there.

Along the way, the coordinates reported in ::handle-dragged have been
fixed so there is no small jumps in either axis (most noticeable in the
X axis when you started dragging, and in the Y axis when moving between
lines of different heights.
2015-10-14 18:44:34 +02:00
Ross Lagerwall
f2b848a531 gtkplacessidebar: Show drives with removable media
Some drives have removable media that is not ejectable (e.g. a laptop's
SD card reader). Show volumes on these drives in the sidebar.

https://bugzilla.gnome.org/show_bug.cgi?id=755654
2015-10-14 17:38:25 +01:00