Commit Graph

558 Commits

Author SHA1 Message Date
Benjamin Otte
cf2d549e92 widget: Implement gtk_widget_pick()
... and use it.
2017-11-05 05:13:17 +01:00
Benjamin Otte
bd6b6ed93c gdk: Remove VisibilityNotify events 2017-11-01 22:00:34 +01:00
Benjamin Otte
2d31a5499a gdk: Remove gdk_get_display_arg_name()
Since we're no longer allowing arguments, this is always NULL now.
2017-11-01 18:26:34 +01:00
Matthias Clasen
2926669a9b gtk: Stop handling settings events
We don't need this anymore, now that we use the ::setting-changed
signal.
2017-10-30 09:48:51 -04: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
e0a3c9d2de gtkmain: Ensure to emit real GDK_LEAVE_NOTIFY events.
If we got a GDK_LEAVE_NOTIFY event from GDK, we would reset the
GtkPointerFocus, but the event would be silently consumed.
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
Carlos Garnacho
f2ded6a685 gtk: Change gtk_propagate_event() to propagate both ways.
This change is made for consistency, it doesn't make sense to expose
one-way propagation, as it can only break expectations from GTK+. This
function might be made entirely private in the future, but it still
makes sense to do this in one go for our internal usecases.
2017-09-19 18:39:03 +02:00
Matthias Clasen
c68c754f3e settings: Convert to GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
e2e91bf9bc Fix a few documentation issues 2017-07-19 21:27:15 -04:00
Timm Bäder
51e25aaff4 main: Protect against non-GtkWindow toplevels 2017-07-19 21:27:14 -04:00
Rico Tzschichholz
a4e80efee7 gdk/gtk: Fix Since tags for 3.92 symbols
In addition to 406db15066
2017-05-30 15:10:25 +02:00
Carlos Garnacho
0d7fe2ec09 gtk: Check implicit grab status before sending crossing events
As we now refrain from sending the crossing events if there's an
implicit grab, those events must be sent on button release when
the implicit grab is broken.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
f5fde52d61 gtk: Refactor crossing event synthesization into a separate function
This is now called outside update_pointer_focus_state() with the events
that actually matter (i.e. pointer ones, so no sequence == NULL checks)
2017-05-25 16:25:59 +02:00
Carlos Garnacho
e892e20841 gtk: Rework pointer cursor selection
Check the grab widget (both explicit and implicit) and check for a cursor
from the target widget up to this grab widget. If the target widget is
outside the grab widget, only the grab wigdet's cursor will be checked.

This also means that we have to ensure the cursor is updated on button
releases, as an implicit grab being deactivated must trigger a cursor
lookup from the target widget.
2017-05-25 16:25:59 +02:00
Timm Bäder
8371b6b857 main: Automatically (un)set PRELIGHT state on widgets 2017-05-25 16:25:59 +02:00
Timm Bäder
34fdc51392 Constify GdkEvent parameters in gtk_get_event_widget and _event_target 2017-05-25 16:25:59 +02:00
Timm Bäder
a0016758a8 widget: Copy event in gtk_widget_event and _captured_event
To ensure that we never translate the coordinates to widget coordinates
twice.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
33c5f3c193 gtkmain: Add API to get the target of a GdkEvent
This can be used on grabbing situations to determine the target of
the event. This mainly matters for GtkMenu.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
da56fae5df gtkmain: Ensure there is a current event handling crossing events
The "current event" will be the real one that is triggering the crossing
notifications, not the synthesized events.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
03a63204c1 gtkmain: Ignore GDK_CROSSING_GRAB/UNGRAB crossing events for picking purposes
Especially with owner_events=TRUE, this doesn't mean anything for picking, as
events will be reported as usual inside the application.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
5483b9db2d gtkmain: Avoid doubly propagation of enter/leave events from windowing
Crossing events are already generated when picking the new pointer position,
so we don't have to propagate the windowing crossing event as-is.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
fa04bf6238 gtkmain: Use window-internal API to update pointer cursors 2017-05-25 16:25:59 +02:00
Carlos Garnacho
3dfab962fa gtk: Implement per-focus implicit grabs
Unlike GTK+ grabs which are global to all/one device, the implicit grab
is per focus, which means each may have implicit grabs on different or
the same widget.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
79e267a330 gtk: Implement cursor updates
As we don't obey GdkWindow cursors anymore, someone must set those.
Use the private Gtkwidget API at the moment.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
e25fcf983a gtk: Handle events with coordinates in toplevel-relative ones
Implement target finding per-pointer/touchpoint through GtkPointerFocus and
_gtk_toplevel_pick(). Focus changes are handled through the emission of
crossing events between the old target and the new one.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
53c297436d gtk: Add private _gtk_toplevel_pick() method
This function returns both the widget at the given toplevel coordinates,
and the translated x/y in widget relative coordinates.
2017-05-25 16:25:58 +02:00
Timm Bäder
6b12e3948e gtkmain: Fix code example
gtk_init doesn't take parameters anymore
2017-04-25 20:30:37 +02:00
Murray Cumming
158015be6c
docs: Remove mentions of gtk_init_with_args().
Because it has been removed: See commit 7e8eb3ddcd
2017-03-17 21:12:12 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Chun-wei Fan
3629def0d0 gtkmain: Fix build on Windows
gtk_init() removed its support for supporting arguments, so we ought to do
likewise for Windows, which actually defines items that call gtk_init()
the old way (and also get rid of argument support in those functions,
since the direction is to not support them).

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-01-20 19:50:02 +08:00
Benjamin Otte
f8b6831c98 gtk: Register GSK resources at startup
That way they show up in the resource list in the inspector even when
running with the Cairo renderer.
2017-01-20 01:19:02 +01:00
Matthias Clasen
7a13715736 Drop arguments from gtk_init
This is our ultimate goal: no more commandline argument handling.
Lots of callers will have to be updated.
2017-01-19 13:21:12 -05:00
Matthias Clasen
f2ee897009 Simplify initialization code
Now that gtk_get_option_group and gtk_parse_args are no longer
public, we can get rid of them.
2017-01-19 13:21:12 -05:00
Matthias Clasen
64b40c65ae Drop the --gtk-debug and --gtk-no-debug options
We have environment variables that cover this.
2017-01-19 13:21:12 -05:00
Matthias Clasen
4cfcca7997 Drop the --g-fatal-warnings argument
We don't need it, GLib has an environment variable for this.
2017-01-19 13:21:12 -05:00
Matthias Clasen
9c52f6b3ca Drop the --gtk-modules argument
We don't need it; the environment variable is enough.
2017-01-19 13:21:12 -05:00
Matthias Clasen
63d6e2d8e2 Don't export gtk_get_option_group
We want to get rid of commandline option handling in GTK+.
This is a step in that direction.
2017-01-19 13:21:12 -05:00
Matthias Clasen
42fd5a0b8b Stop exporting gtk_parse_args
We want to stop handling commandline arguments, and that is the
sole purpose of this function. So it has to go
2017-01-19 13:21:12 -05:00
Matthias Clasen
7e8eb3ddcd Drop gtk_init_with_args
We want to simplify our initialization code and remove all commandline
argument handling from it. The first stop for this is to reduce the
number of gtk_init variants we have.
2017-01-19 13:21:12 -05:00
Matthias Clasen
507a1e4d7a Make GTK_DEBUG=interactive work better
We currently have various ways to initialize GTK+, and not
all of them were supporting this way of bringing up the
inspector. Fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=776807
2017-01-07 19:16:15 -05:00
Timm Bäder
7d0e534969 gtkmain: Correctly notify all widgets of a grab 2017-01-07 17:19:30 +01:00
Benjamin Otte
def94f03e2 debug: Add GTK_DEBUG=snapshot
This causes the snapshotting algorithm to dump all widget nodes into
their own container node. We then name that group accordingly (ie
"GtkSwitch<0xdeadbeef>") so you can easily see which node belongs where.

The feature is toggleable in the inspector's visual tab.

There's a few problems with it, becuse GtkSnapshot optimized container
nodes away if they are not needed, so we are losing some widgets...
2016-12-20 19:26:40 +01:00
Benjamin Otte
22a657004b debug: Remove pixel-cache debug categories
We have no more pixel cache, so they are kind of useless.
2016-12-20 19:26:40 +01:00
Matthias Clasen
3414f10bad Drop the GDK_PRIVATE_CALL mechanism
We don't need to do this extra complication anymore, since
we're now living inside a single shared library.
2016-11-23 19:31:16 -05:00
Benjamin Otte
48f5df5318 gtk: Add back infrastructure for GTK_DEBUG=updates
Includes the ability to turn on updates in the inspector. Animations are
now run via a tick function which allows us to neatly overlay a
semi-transparent red rectangle and fade it out over time.

It also probably enables way more, but somebody with more UI neatness
than me needs to figure out what it eanbles first...
2016-10-27 05:07:23 +02:00
Benjamin Otte
1df8b15711 gtk: Remove gdk_window_invalidate() from docs
And replace its mentions with gtk_widget_queue_draw().
2016-10-27 05:07:23 +02:00
Timm Bäder
6c911c8171 remove GTK_DEBUG_PLUGSOCKET
Both GtkPlug and GtkSocket are gone so this doesn't make a lot of sense
anymore.
2016-10-22 19:30:01 +02:00
Timm Bäder
feb8975a4b gtkmain: Remove deprecated key snooper API 2016-10-18 00:29:17 +02:00
Emmanuele Bassi
fc9826fb41 Remove declarations for getresuid()/getresgid()
Back in 2001, their prototypes were missing from system headers, but
since glibc 2.3.2 they are defined in unistd.h if _GNU_SOURCE is
defined.
2016-10-17 11:44:11 +01:00