Commit Graph

34089 Commits

Author SHA1 Message Date
Matthias Clasen
a5f58e8d28 main: Use event constructors
At the same time, stop setting child_surface in
crossing events. Nothing in GTK looks at it.
2020-02-21 00:40:52 -05:00
Timm Bäder
018870643a scale: Remove useless extra local variable 2020-02-20 10:30:14 +01:00
Timm Bäder
aa53fef39c scale: Remove unused member 2020-02-20 10:23:09 +01:00
Timm Bäder
faddbb18d3 emojichooser: Add style class to emoji toolbar
Closes #1013
2020-02-20 10:23:09 +01:00
Timm Bäder
f14978c68f filechooserwidget: Fold function into only caller 2020-02-20 10:23:09 +01:00
Timm Bäder
c0de02520c filechooserwidget: Use a proper GtkPopoverMenu
Instead of a fake one where we add .menu to a normal popover. This makes
the menu look like other context menus.
2020-02-20 10:23:09 +01:00
Timm Bäder
b58f9e2aa2 filechoosererrorstack: Set a layout manager
Otherwise it doesn't know what to do with its child widget.
2020-02-20 10:23:09 +01:00
Timm Bäder
b8a752c751 filechooserwidget: Allow typing a location in recent mode
This is triggered by typing / or hitting Ctrl+L. Since we don't have a
visual indicator for this mode right now anyway, the reason for not
allowing it in recent mode cited in the comment just above the
early-exit is irrelevant.

Closes #2178
2020-02-20 10:23:09 +01:00
Timm Bäder
194039c749 filechooserwidget: Remove unused constants 2020-02-20 10:23:09 +01:00
Timm Bäder
64d0f848bc text: Remove gtk_text_get_im_context()
Unused.
2020-02-20 10:23:09 +01:00
Timm Bäder
e18a159f16 spinbutton: Remove manual queue_draw() calls
Everything is automatically redrawn when changing the value, etc.
2020-02-20 10:23:09 +01:00
Timm Bäder
a1bc3ae2c8 popvermenu: Clarify css node docs
We add the .menu css class to the popover main node, not its contents
node.
2020-02-20 10:23:09 +01:00
Timm Bäder
2ad6c045b4 aboutdialog: Clarify docs and fix preconditions 2020-02-20 10:23:09 +01:00
Timm Bäder
ec6d5839bd modelbutton: Un-select on mouse leave
This brings us closer to the old GtkMenuItem behavior and also makes
more sense.
2020-02-20 10:23:09 +01:00
Timm Bäder
2bf9a5bd29 aboutdialog: Replace visited_links GList with GPtrArray 2020-02-20 10:23:09 +01:00
Timm Bäder
b5d4815eb7 aboutdialog: Use new GtkStackPage API 2020-02-20 10:23:09 +01:00
Timm Bäder
188f00e05a stack: Add GtkStackPage:visible accessors 2020-02-20 10:23:09 +01:00
Benjamin Otte
9660ae5556 Merge branch 'wip/xdg-popup-async-relayout' into 'master'
Synchronous popup layout

See merge request GNOME/gtk!1241
2020-02-19 18:57:14 +00:00
Jonas Ådahl
ca71119a40 gdk/surface: Replace move_to_rect() with GdkPopupLayout based API
Replace the gdk_surface_move_to_rect() API with a new GdkSurface
method called gdk_surface_present_popup() taking a new GdkPopupLayout
object describing how they should be laid out on screen.

The layout properties provided are the same as the ones used with
gdk_surface_move_to_rect(), except they are now set up using
GdkPopupLayout.

Calling gdk_surface_present_popup() will either show the popup at the
position described using the popup layout object and a new unconstrained
size, or reposition it accordingly.

In some situations, such as when a popup is set to autohide, presenting
may immediately fail, in case the grab was not granted by the display
server.

After a successful present, the result of the layout can be queried
using the following methods:

 * gdk_surface_get_position() - to get the position relative to its
   parent
 * gdk_surface_get_width() - to get the current width
 * gdk_surface_get_height() - to get the current height
 * gdk_surface_get_rect_anchor() - to get the anchor point on the anchor
   rectangle the popup was effectively positioned against given
   constraints defined by the environment and the layout rules provided
   via GdkPopupLayout.
 * gdk_surface_get_surface_anchor() - the same as the one above but for
   the surface anchor.

A new signal replaces the old "moved-to-rect" one -
"popup-layout-changed". However, it is only intended to be emitted when
the layout changes implicitly by the windowing system, for example if
the monitor resolution changed, or the parent window moved.
2020-02-19 09:47:18 +01:00
Jonas Ådahl
f43717a42e popover: Unrealize when autohide prop changes
Changing the autohide property means the popover needs to be remapped.
Remapping may need user interaction, so lets just unrealize the popover
if the property changes, forcing the application to remap it should it
be shown again.
2020-02-19 09:47:18 +01:00
Timm Bäder
5097c1defc Merge branch 'file-filter-name-property' into 'master'
GtkFileFilter: Add a GObject property for the name

See merge request GNOME/gtk!376
2020-02-19 07:43:51 +00:00
Matthias Clasen
66307f00f1 icontheme: Update the api
Add properties, and use string arrays instead of lists.

Among other things, this renames gtk_icon_theme_list_icons
to gtk_icon_theme_get_icon_names.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2410
2020-02-18 20:32:17 -05:00
Benjamin Otte
732716ba95 debug: When debug-printing, treat NULL as the default display
Otherwise we lose debug prints from all code that allows NULL displays.
2020-02-19 01:21:33 +01:00
Matthias Clasen
03ee4229f2 Merge branch 'wip/otte/dnd' into 'master'
More DND rework

See merge request GNOME/gtk!1445
2020-02-18 22:15:56 +00:00
Sebastian Dröge
8378eb22a3 GtkDialog: Add type Gtk.HeaderBar annotation to headerbar getter return value 2020-02-18 10:55:31 +02:00
Benjamin Otte
0d4d4e9a8c colorbutton: Fix drag source
By running it in the capture phase, it will not be starved for events by
the button's click source and make drags actually start a color drag
operation.
2020-02-18 02:58:58 +01:00
Benjamin Otte
b8cf7ea1c6 dnd: Port the TreeModel machinery to GValue DND 2020-02-18 02:40:00 +01:00
Benjamin Otte
1145da3ea5 placessidebar: Modernize DND
No more shooting pointers through pipes
2020-02-17 21:56:16 +01:00
Benjamin Otte
27d7aa1407 notebook: Use proper DND
Actually use GValues for the DND operation instead of sending GBytes of
pointer addresses through pipes.

This is a bit complicated because we need to special-case rootwindow
drops, because they're handled on the source side, so we need a custom
ContentProvider.
2020-02-17 21:56:16 +01:00
Benjamin Otte
9703fcc605 notebook: Move dnd scrolling via arrows to own drop target
This removes excess code from the tab dnd machinery
2020-02-17 21:56:16 +01:00
Benjamin Otte
e25bfa6a61 dragdest: Handle NULL content formats everywhere
NULL means we don't do content formats checks and accept everything.

We use this for notebook arrows or expanders that react to ongoing
drags.
2020-02-17 21:56:16 +01:00
Matthias Clasen
a838a54dca text: Treat Emoji insertion like clipboard
Enter the Emoji inseration in the undo history.
Also, stop stashing away the selection when we
pop up the Emoji chooser, and use the selection
as-is when we insert the Emoji.
2020-02-17 15:05:09 -05:00
Benjamin Otte
f5e3584b5b placessidebar: Don't claim to support text dnd
Because you don't. And never did.
2020-02-17 04:04:21 +01:00
Benjamin Otte
80ba7fd682 dragdest: Make gtk_drop_target_new() args be transfer full
Saves tons of code.
2020-02-17 04:04:21 +01:00
Benjamin Otte
91d91a29e8 colorbutton, colorswatch: Simplify DND
- Use GDK_TYPE_RGBA and let GDK do the conversion from
  application-x-color
- Don't do extra mime type checks when accept() does that for us already
2020-02-17 04:04:21 +01:00
Benjamin Otte
3a7e3cf90d dragdest: Simplify function
Make it obvious that the functions checks one condition and then the
other.
2020-02-17 04:04:21 +01:00
Benjamin Otte
e1f8c1430f dnd: simplify code
The old code did mimetype checks everywhere when type compatibility has
since been moved to the GtkDropTarget::accept signal.

So the code can now just assume a compatible mime type exists.
2020-02-17 04:04:21 +01:00
Benjamin Otte
da83457a60 dnd: Remove gdk_content_provider_new_with_callback()
Content providers are meant to be immutable, apart from very special
cases, but in those cases they need to emit
gdk_content_provider_content_changed().

Having a constructor that just uses a get_func invites abuse of this
by not making developers aware of those requirments.
In fact, all users in GTK failed to do this.

Instead, code should use the GtkDragSource::prepare signal to create
content providers when needed.

The same problem exists with gdk_content_provider_new_with_formats(),
but this commit doesn't touch that.
2020-02-16 20:10:31 +01:00
Benjamin Otte
8d2ed36a1b contentprovider: Add gdk_content_provider_new_typed()
Gets around the boilerplate required to create and initialize a GValue
by having this function doing it via G_VALUE_COLLECT().
2020-02-16 20:10:30 +01:00
Benjamin Otte
410dbdf671 widget: Fix namespacing problem
In Vala and JS at least, gtk_widget_get_css_name() and
gtk_widget_class_get_css_name() are resolved to
GtkWidget.get_css_name().

To avoid this problem, we rename the class version.
2020-02-16 20:05:05 +01:00
Benjamin Otte
43b8aff62c widget: Fix typos for css-clases property 2020-02-16 19:57:45 +01:00
Benjamin Otte
47c8026e38 Merge branch 'wip/otte/dnd' into 'master'
some DND fixes

See merge request GNOME/gtk!1440
2020-02-15 23:45:25 +00:00
Benjamin Otte
894ac6c126 dragdest: Use format matching APIs 2020-02-15 21:04:33 +01:00
Timm Bäder
08501c9510 calendar: Emit {next,prev}-{month,year} signals
Fixes #833
2020-02-15 17:18:27 +01:00
Timm Bäder
a4ecfd8f33 widget: Use get_css_name() in get_property()
Instead of reimplementing it there.
2020-02-15 17:18:27 +01:00
Timm Bäder
28482e52be Adwaita: Add focus outlines back to scale troughs
Fixes #189
2020-02-15 17:18:27 +01:00
Timm Bäder
bf839dbb88 coloreditor: Scale h value to 360
Fixes #1321
2020-02-15 17:18:27 +01:00
Timm Bäder
2529464e21 range: Avoid rounding errors when allocating highlight
Fixes #2438
2020-02-15 17:18:26 +01:00
Timm Bäder
7e43034068 widget: Add css-classes property
Mirroring the values added and removed via {add,remove}_css_class().
2020-02-15 17:18:26 +01:00
Timm Bäder
52979a0e93 infobar: Remove _get_{action,content}_area()
Accessors like these are weird to have and we can add widgets to the
content area via gtk_container_add() as well as add widgets to the
action area via gtk_info_bar_add_action_widget().
2020-02-15 17:18:26 +01:00