Commit Graph

147 Commits

Author SHA1 Message Date
Matthias Clasen
0063145ed8 tooltip: Set icon from texture instead of pixbuf
Another part of removing GdkPixbuf from APIs.
2017-11-29 22:17:59 -05:00
Benjamin Otte
8df61992d7 tooltips: Remove GtkIconSize usage 2017-11-15 14:22:16 -05:00
Benjamin Otte
07164e098a window: Turn gtk_window_set_screen() into gtk_window_set_display()
And have a priv->display instead of a priv->screen.

Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
2017-10-31 08:25:37 +01:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
44cb3ccfa1 gdk: Remove motion hints
Motion hints are now literally a thing of the past. Everything should be
using the full motion event stream.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Matthias Clasen
853602bf63 tooltip: Use GdkEvent API
And at the same time, reshuffle things slightly to avoid
creating synthetic events.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
b4f88e1544 tooltip: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Olof-Joachim Frahm
621d1bb4ec Make sure to remove tooltip timeout.
Otherwise in GC-ed environments the `g_source_remove` call during
disposal might be called on an already removed source, which results in
unnecessary console output.

https://bugzilla.gnome.org/show_bug.cgi?id=778301
2017-05-08 18:05:21 -04:00
Daniel Boles
7e38e3075e Tooltip: Avoid redundant variable initialisations
has_tooltip_widget was assigned twice in immediate succession.

return_value is not used anywhere else in this function since commit
14a864c8b5 and does not need a default
value anymore, so move it to the inner scope and don't init to NULL.
2017-03-20 21:13:50 +00:00
Timm Bäder
14a864c8b5 tooltip: Remove unused assignment
hide_tooltip  gets overriden in any case 2 lines down, and return_value
isn't used later in that function. The second assignment was introduced
in ef1da5f6c2, directly below the first
assignment.
2017-03-20 15:36:05 +01:00
Matthias Clasen
a013a16d1c Use _gtk_widget_get_window more
This avoids type checks in places where we know it is safe.
2017-01-10 19:56:02 -05:00
Alexander Larsson
70935f0952 Drop support for offscreen GdkWindows
These complicate a lot of GdkWindow internals to implement features
that not a lot of apps use, and will be better achieved using gsk.
So, we just drop it all.
2016-10-25 09:54:37 +02:00
Emmanuele Bassi
44885bcfed Remove redundant declarations 2016-10-17 11:10:14 +01:00
Timm Bäder
ad155fb26c Remove GtkStock API from GtkImage 2016-10-16 18:17:21 +02:00
Matthias Clasen
321ddb8697 Make gtk_tooltip_trigger_tooltip_query work again
This was broken ever since we started looking at the
source device of the event.

https://bugzilla.gnome.org/show_bug.cgi?id=674215
2016-06-05 21:47:16 -04:00
Timm Bäder
fd81e801ab tooltip: Include gtkwidgetprivate.h
That's where gtk_widget_query_tooltip is defined.
2016-05-08 15:52:56 +02:00
Matthias Clasen
ed147c88e1 tooltip: Add a missing *
This was an oversight in the previous commit.
2016-05-06 20:51:25 -04:00
Matthias Clasen
12dfb368e2 Don't emit ::query-tooltip by name
This signal is emitted quite a bit, and we can easily avoid it.
2016-05-06 10:14:07 -04:00
Matthias Clasen
64710def82 Stop storing has-tooltip in qdata
This is queried quite a bit, and we have room for an extra
bit in GtkWidgetPrivate.
2016-05-06 10:14:07 -04:00
Matthias Clasen
d91b8c91d3 tooltip: Ensure our quark is not 0
Many of the tooltip functions can be called before a tooltip
object is created, and thus initializing the quark in class_init
is not good enough.
2016-05-06 06:44:28 -04:00
Matthias Clasen
b5fb9ae3b7 gtk: Port to new monitor api
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Matthias Clasen
0ac71e81cf Drop some unused debug printfs
Remove some debug spew that has been ifdef'ed out for years
and does not look useful enough to keep.
2016-02-28 21:40:23 -05:00
Christoph Reiter
f66191346c Mention GtkIconSize in all docs where the argument/return is annotated as taking an int instead of GtkIconSize
In https://bugzilla.gnome.org/show_bug.cgi?id=601425 the annotations
were changed to int as they not only take the predefined enum values
but also user defined values registered through gtk_icon_size_register()

As a result the typelib doesn't contain any information about
GtkIconSize for those arguments and the Python docstring only
shows the corresponding Python type "int".

This changes the argument docs to mention the type explicitly
so the Python doc generator can add a link to Gtk.IconSize
which contains the most useful predefined values.

https://bugzilla.gnome.org/show_bug.cgi?id=757411
2016-01-04 11:56:44 +01:00
Carlos Garnacho
3d516449d4 GtkTooltip: Avoid gdk_device_manager_get_client_pointer()
It's now deprecated
2015-12-15 23:17:37 +01:00
Emmanuele Bassi
a846fd586d Add GtkTooltipWindow private sub-class
GtkTooltip does a lot of set up on the GtkWindow it uses internally. We
should move that code to a separate class to keep it contained.
2015-11-10 13:23:18 +00: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
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
Matthias Clasen
29c799a1e7 Use g_object_get_qdata instead of g_object_get_data
This is less expensive.
2015-09-12 12:50:39 -04:00
Matthias Clasen
0ebcc56a77 tooltip: Remove unnecessary checks
Coverity uses these as clues to complain.
2015-07-17 18:40:37 -04:00
Matthias Clasen
db28b8c600 tooltip: Minor cleanup
Preserve the symmetry in gtk_tooltip_set_last_window.
2015-03-22 11:47:23 -04:00
Stefan Sauer
bb78a39103 tooltip: remove unused variable and related g_object_set
We never use the value of has_tooltip. This is a left-over from the refactoring
of gtk_tooltip_run_requery().
2015-03-03 09:59:53 +01:00
Matthias Clasen
50c848a992 Explicitly set the a11y role of tooltip windows
This seems better than trying to identify the 'tooltipness'
of the window on the other side.

https://bugzilla.gnome.org/show_bug.cgi?id=744683
2015-02-18 17:28:08 -05:00
Robert Ancell
0f26b26f1d Gdk: add an experimental backend for mir
This is disabled by default.  Enable with --enable-mir-backend.

This backend is a combined work of Robert Ancell and Ryan Lortie.
2014-10-22 11:17:15 -05:00
Matthias Clasen
e3ef5d6fd2 GtkTooltip: Move nonexported API to a private header
This is our standard practice nowadays.
2014-10-19 22:51:21 -04:00
Michael Catanzaro
62da080bd0 tooltip: fix line wrapping
We enable line wrap on the internal GtkLabel, but nowadays this does
nothing unless we also set a max number of characters.

https://bugzilla.gnome.org/show_bug.cgi?id=737929
2014-10-06 21:30:18 -04:00
Bastien Nocera
c849b8edd6 tooltip: Fix warning with GtkCellRendererAccel
(gnome-shell-extension-prefs:22382): GLib-GObject-WARNING **: invalid cast from 'GtkInvisible' to 'GtkWindow'
(gnome-shell-extension-prefs:22382): Gtk-CRITICAL **: gtk_window_set_transient_for: assertion 'parent == NULL || GTK_IS_WINDOW (parent)' failed

 #1  0x00007fffeeb81a12 in g_log (log_domain=log_domain@entry=0x7fffeeea3464 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7fffeeeaa878 "invalid cast from '%s' to '%s'") at gmessages.c:1079
 #2  0x00007fffeee9c2a9 in g_type_check_instance_cast (type_instance=0xb314c0, iface_type=iface_type@entry=9020048) at gtype.c:4021
 #3  0x00007ffff0a06e25 in gtk_tooltip_set_last_window (tooltip=tooltip@entry=0xbb8c10, window=<optimized out>) at gtktooltip.c:910
 #4  0x00007ffff0a08dfd in _gtk_tooltip_handle_event (event=event@entry=0xbf72c0) at gtktooltip.c:1538
 #5  0x00007ffff090d7a9 in gtk_main_do_event (event=0xbf72c0) at gtkmain.c:1785
 #6  0x00007ffff0496ab2 in gdk_event_source_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at gdkeventsource.c:364
 #7  0x00007fffeeb7a8c3 in g_main_dispatch (context=0x807300) at gmain.c:3067

https://bugzilla.gnome.org/show_bug.cgi?id=736131
2014-09-06 19:05:46 -04:00
Carlos Garnacho
3df8b95e0e tooltip: Use subsurfaces on wayland
This places tooltips in the right place, and avoids having those attempt
to steal the focus.

https://bugzilla.gnome.org/show_bug.cgi?id=735531
2014-08-28 16:41:14 +02:00
Matthias Clasen
821955a998 Avoid a compiler warning 2014-07-21 14:13:06 -04:00
Matthias Clasen
c8c6da4ca4 GtkTooltip: Drop an unused variable
The toplevel_window was never set, and the only place where it
was used was causing us to hide tooltips needlessly. So removing
it is a double win.

https://bugzilla.gnome.org/show_bug.cgi?id=733321
2014-07-21 12:40:57 -04:00
Matthias Clasen
77cb6d8b4a GtkTooltip: Ignore shadow when finding widgets
When placing tooltips, the csd shadow will get 'pushed up' and
may end up underneath the pointer. We don't want this to cause
the tooltip to be hidden, because that leads to flickering, so
ignore the shadow when finding the widget under the pointer.
2014-06-11 00:04:04 -04:00
Matthias Clasen
a39985a43e Request csd for tooltips
Use the new private GtkWindow api to request
client-side decorations for tooltips.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:15:28 -04:00
Matthias Clasen
179d6a4c7b GtkTooltip: take csd shadows into account for placement
When placing tooltips, we don't want the shadow to influence
our choice.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:15:28 -04:00
Matthias Clasen
49bb39ecf5 GtkTooltip: remove hardcoded tooltip drawing
This is old code from dating back many years. Nowadays, we can
just use css drawing and csd windows to achieve much the same
effect.

Themes will need some adjustment for this change.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:15:27 -04:00
Matthias Clasen
55b0019589 GtkTooltip: Avoid extra work
When we are hiding the label or icon anyway, no need to change
it right before, causing reallocation overhead.
2014-02-20 18:31:10 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
Matthias Clasen
30cc1512e6 Docs: Use markdown for lists
This greatly reduces the amount of xml in the docs.
2014-02-02 01:07:39 -05:00
Yosef Or Boczko
719dd636a9 Replace all margin-left and margin-right with margin-start and margin-end
https://bugzilla.gnome.org/show_bug.cgi?id=710238
2013-11-15 02:54:35 +01:00
Bastien Nocera
438cd857c4 all: Add names to timeouts
Add names to every timeout we setup, so it's easier to track their
usage, and debug possible misbehaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=710651
2013-10-23 13:31:18 +02:00