Commit Graph

312 Commits

Author SHA1 Message Date
Matthias Clasen
2232430a5a Redo csd window-dragging
The window-dragging code had a number of issues: The code was
starting a drag on every button press, never bothering to cancel
them. This leads to the odd hand cursor occurring between the two
clicks to maximize. We relied on GDK's multi-click detection, which
gives us triple-clicks when we really want sequences of double-clicks.
Lastly, we didn't propery restrict double-click handling to the primary
button, so e.g. if you had a window on an empty workspace, double-right
click on the titlebar would maximize it, which is not intended.

This commit solves all three problem by a doing our own double-click
detection, and only starting a drag when the pointer goes out of
'double-click range'. We change the way dragging is implemented for
menubars and toolbars to just letting events bubble up, so they
get the same behaviour as the titlebar. To make this work, we
have to select for pointer motion events in a few more places.
2014-01-12 22:25:19 -05:00
Jonh Wendell
9d8a32b07d toolbar: draw a full box for separators
This allows themes do whatever they want as separators, with
paddings, borders and backgrounds.

If "wide-separators" property is true, then, instead of just draw
a frame, also render its background, and take into account the
padding property for its limits.

https://bugzilla.gnome.org/show_bug.cgi?id=719713
2013-12-03 09:55:58 -02:00
Marco Brito
d31f3e5766 Add class toolbar before the style context is created for the widget.
The call to gtk_button_set_relief() in gtk_toolbar_init() indirectly
used the style context of the half-created widget, before we had a
chance to add the "toolbar" style class to it.

Reorder gtk_toolbar_init() to ensure that the proper style class is
set first.

https://bugzilla.gnome.org/show_bug.cgi?id=719595
2013-12-01 17:20:30 -05:00
Lionel Landwerlin
be5b6460e7 menushell/toolbar/window: implement toggle maximize on double click
https://bugzilla.gnome.org/show_bug.cgi?id=700419
2013-11-09 14:19:47 -05:00
Jonh Wendell
c292401162 toolbar: implement minimum and natural sizes in _get_preferred family
currently it's using the same sizes for natural and minimum, but it
happens that, when it's allowed to use the arrow, the minimum size
can be smaller than natural.

https://bugzilla.gnome.org/show_bug.cgi?id=693227
2013-11-09 13:26:35 -05:00
Jasper St. Pierre
3971ed1779 gtktoolbar: Make the icon-size property actually an enum
As this is what it's interpreted as.
2013-10-18 16:14:26 -04:00
Matthias Clasen
624ec0fb7d Add a style class for context menus
Attached widgets inherit from the style of the widget they are
attached to. This can sometimes have unintended consequences,
like a context menu in the main view of gedit inheriting the font
that is configured for documents, or the context menu of the preview
in the font chooser coming up with humongous font size.

To fix this problem, we introduce a context menu style class
and use it for all menus that are used like that. The theme
can then set a font for this style class.

https://bugzilla.gnome.org/show_bug.cgi?id=697127
2013-08-18 13:46:48 -04:00
Matthias Clasen
2f1fa7cdc3 Drop some unnecessary includes
Drop includes of deprecated headers where they are
no longer needed.
2013-07-19 22:32:23 -04:00
Matthias Clasen
0aa57d26b5 Move wholly deprecated classes to gtk/deprecated/
We've recently a number of classes wholly. For these cases,
move the headers and sources to gtk/deprecated/ and adjust
Makefiles and includes accordingly.

Affected classes:
GtkAction
GtkActionGroup
GtkActivatable
GtkIconFactory
GtkImageMenuItem
GtkRadioAction
GtkRecentAction
GtkStock
GtkToggleAction
GtkUIManager
2013-07-19 21:39:47 -04:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
William Jon McCann
7b66956e63 Deprecate and hardcode default toolbar icon size setting
Toolbar icon size can still be changed on a per-widget basis as
needed by the application developer.
2013-07-08 15:02:28 -04:00
William Jon McCann
425e977bb6 Deprecate and hardcode default toolbar style setting
Toolbar style can still be changed on a per-widget basis as
needed by the application developer.
2013-07-08 15:02:28 -04:00
Cosimo Cecchi
a07f767ed4 Revert "toolbar: Don't special-case RTL toolbar child positions anymore"
This reverts commit 821a675013.

https://bugzilla.gnome.org/show_bug.cgi?id=694451
2013-02-23 14:53:23 -05: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
821a675013 toolbar: Don't special-case RTL toolbar child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl)
  {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
7747910b9d gtk: Use context's font
Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.
2012-12-06 02:57:18 +01:00
Cosimo Cecchi
a5ddbaf1f8 toolbar: don't forget to set orientable style classes
So that themes can select for vertical toolbars.
2012-10-10 11:37:16 -04:00
William Jon McCann
8a9a3949dd Don't leak a ref to the settings
https://bugzilla.gnome.org/show_bug.cgi?id=683896
2012-09-16 20:21:06 -04:00
Cosimo Cecchi
8062e471d1 toolbar: deprecate shadow-type style property
While shadow-type *properties* can make sense, to opt-out of the
padding/border machinery programmatically, having it as a style
property doesn't make any sense, since we have a better way to change
the bevel style from the theme already.
This commit deprecates the shadow-type style property in GtkToolbar.
2012-08-07 16:08:45 +02:00
Cosimo Cecchi
1ec6329f18 toolbar: don't request CSS padding twice
This is a regression from commit
d0d21a4f00.

We are requesting the CSS padding twice: once unconditionally and
another time if SHADOW_TYPE != NONE, which is usually the case.
2012-08-07 16:05:30 +02:00
Cosimo Cecchi
512fee6363 toolbar: deprecate internal-padding style property
This is equivalent to a regular CSS padding, and that's what people
should use.
2012-08-07 12:55:37 +02:00
Paolo Borelli
d0d21a4f00 Make GtkToolbar honour css border and padding
The widget is already calling gtk_render_frame, but is not measuring css
border and padding when negotiating its size. This patch replaces the
already existing get_internal_padding static helper with a function that
sums the old internal-padding value with the values specified via css.
2012-08-05 12:52:36 +02:00
Cosimo Cecchi
ad63d1b59e toolbar: don't call gtk_style_context_set_background()
GtkToolbar doesn't have its own GdkWindow to draw on (it calls
gtk_widget_set_has_window(FALSE) in _init), but only an event window
(input-only).
Since gtk_widget_get_window() in that case will return the GdkWindow of
the parent container, by calling gtk_style_context_set_background() here
we're overriding the base background of the container instead of our.
While in most cases this doesn't have any noticeable effect, since
the toplevel GtkWindow will paint its background on top of it at the
beginning of the draw cycle, when the classic window hierarchy is
broken, such as when widgets are rendered through a clutter-gtk
offscreen embedding, the background will become visible, which is
undesirable.
Fix this by having GtkToolbar not call gtk_style_context_set_background
in its style_updated handler.
2012-06-13 20:10:41 -04:00
Matthias Clasen
2cecc1f922 GtkToolbar: Prevent accidental drag starts
We don't want to start drags on double- or triple clicks, and
doing so causes problems for embedded range widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=675535
2012-05-25 23:17:43 -04:00
Matthias Clasen
33d2af0036 fix the build 2012-05-25 23:14:02 -04:00
Benjamin Otte
33f111a47c widget: Don't cache widget paths all the time
Add an internal API that allows GtkStyleContext to create a widget path
for the widget and with that bypassing gtk_widget_get_path() and that
  function caching the path.
2012-04-17 08:59:21 +02:00
Benjamin Otte
ece9d2fd92 gtk: Make widget only invalidate widget positions
Instead of resetting them completely
2012-04-17 08:59:10 +02:00
Benjamin Otte
461803e407 gtk: Get gtkwidgetpath.h includes out of the public headers
and include them in the C files instead.
2012-03-19 02:26:16 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Rui Matos
4011326388 toolbar: Stop setting state flags on the style context for drawing 2012-01-09 16:45:44 +00: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
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Stef Walter
385b7a3031 gtk: GtkToolbar returns invalid paths when adding tool items
* Calculate siblings_path on demand, so that it's always correct
   and doesn't get out of sync with the toolbar state.

https://bugzilla.gnome.org/show_bug.cgi?id=662177
2011-10-20 14:11:28 +02:00
Michael Natterer
2d3db3421f Bug 659406 - Abstract what triggers a context menu
Add gdk_event_triggers_context_menu(), using the new modifier
abstraction API. Remove _gtk_button_event_triggers_context_menu()
and port all callers.
2011-09-27 15:45:18 +02:00
Benjamin Otte
aebd859ef9 toolbar: Fix widget path creation code
- Ensure arrow button is always included
- Invalidate list when direction changes
2011-09-27 05:37:14 +02:00
Michael Natterer
b663f3a00b Bug 659406 - Abstract what triggers a context menu
Add _gtk_button_event_triggers_context_menu() and use it instead
of checking for event->button == 3, so context menus are invoked
correctly on the Mac.
2011-09-26 16:01:50 +02:00
Matthias Clasen
5445b3d7ec GtkToolbar: Move child removal to dispose
Doing it in finalize is too late and can cause various problems
in ::parent-set signal handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=658200
2011-09-05 11:09:16 -04:00
Matthias Clasen
6f39855c08 More include cleanups 2011-08-28 01:54:55 -04:00
Matthias Clasen
0039418001 GtkToolbar: partial fix for toolbar editing
When using an editable toolbar in evince, we can end up
in gtk_toolbar_get_visible() position with item being the
highlight_tool_item, but not one of the regular children.
So, handle that.
2011-08-27 11:45:01 -04:00
Benjamin Otte
9c30ae02ee toolbar: Use gtk_widget_class_set_accessible_role() 2011-07-18 18:30:50 +02:00
Cosimo Cecchi
668790ddee toolbar: don't leak the sibling path 2011-07-01 12:33:26 -04:00
Cosimo Cecchi
34d85f04e5 toolbar: don't count invisible widgets when building the sibling path
Also, fix RTL nth-child handling for toolbars.
2011-07-01 12:31:22 -04:00
Cosimo Cecchi
9417017f5b toolbar: invalidate order when an item visibility changes 2011-07-01 12:31:22 -04:00
Matthias Clasen
301c120b74 toolbar: nth-child support for GtkToolbar
This doesn't quite work right yet.
2011-07-01 12:31:22 -04:00
Matthias Clasen
b71b560e56 Remove an unused variable 2011-06-17 22:57:35 -04:00
Benjamin Otte
e54ccaee53 toolbar: Better fix for animations
It turns out there's more places where the toolbar item size is used as
the margin box instead of the content box. Because of that, store the
margin box when allocating and use it whenever calls
toolbar_content_get_allocation() instead of calling
gtk_widget_get_allocation().
2011-06-15 22:50:59 +02:00
Benjamin Otte
ba869e0fe0 toolbar: Handle the fact that size_allocate() != get_allocation()
size_allocate() allocates the available space for the margin box,
get_allocation() returns the actual space of the content box and those
can be different. And then animations never stop.
If that makes you go "huh?", you might want to read
http://www.w3.org/TR/CSS21/box.html
and the docs for gtk_widget_compute_align().
2011-06-15 20:14:18 +02:00
Matthias Clasen
32f0761daa Avoid a dereference-before-null-check 2011-06-14 21:50:16 -04:00
Matthias Clasen
900ea46add GtkToolbarPrivate: Improve struct packing 2011-04-12 12:48:55 -04: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