Commit Graph

249 Commits

Author SHA1 Message Date
Matthias Clasen
ddd5704c92 Update references to master in the repository 2021-11-29 17:37:49 -05:00
Matthias Clasen
72dc9a21f7 GtkApplication: Call setlocale early
If we don't call setlocale early enough,
--help output may come out misformatted.

Fixes: #4234
2021-09-06 01:38:47 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Matthias Clasen
06a51c045c application: Tweak docs 2021-03-11 16:37:34 +00:00
Emmanuele Bassi
ec32ff04b8 application: Convert docs
Drop mentions of command line arguments parsed by gtk_init(), and of the
GDK lock.
2021-03-11 16:37:32 +00:00
Emmanuele Bassi
af8d8113eb docs: Remove the last few remaining '+' from GTK 2021-03-11 16:37:30 +00:00
Matthias Clasen
aeca9cb7ba Avoid adding // to resource paths
The GResource machinery is not forgiving about this
sort of thing.

Fixes: #3469
2020-12-11 21:47:54 -05:00
Sophie Herold
1e01b9079d Fix some nullable return annotations 2020-11-21 16:33:40 +01:00
Matthias Clasen
d4e069a629 Port tracing to the sysprof collector api
Use the new sysprof collector api to do tracing.
2020-08-21 10:55:01 -04:00
Matthias Clasen
a416650f6b application: Drop support for profiler activation
Drop support for the org.gnome.Sysprof3.Profiler
D-Bus interface. It is not really used, and if
we don't expose it, we can simplify our profiler
infrastructure.
2020-08-21 10:55:01 -04:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Yuri Chornoivan
c0cf839729 Fix minor typos 2020-06-18 10:47:16 +03:00
Matthias Clasen
79d6a77d58 gtkapplication: Drop app menu support
Drop apis and code related to appmenus from
both GtkApplication and GtkApplicationWindow.

We still keep the menubar support, since it
is needed for system integration on OS X.

Fixes: #2731
2020-05-22 17:31:05 -04:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Matthias Clasen
0b17658a82 Replace most uses of <Primary> with <Control>
The only place where we are still using <Primary> is
in tests, to ensure we keep parsing it. Otherwise,
<Control> is now the preferred syntax.
2020-04-06 17:05:52 -04:00
Emmanuele Bassi
bca1f6b64f gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-25 23:14:27 -04:00
Christian Hergert
ccac404f28 widget: fix class private data usage to be _init() safe
Before this commit, adding GtkWidgetAction to class private data would
require copying the actions to each subclass as they were built or
modified. This was convenient in that it is a sort of "copy on write"
semantic.

However, due to the way that GTypeInstance works with base _init()
functions, the "g_class" pointer in GTypeInstance is updated as each
_init() function is called. That means you cannot access the subclasses
class private data, but only the parent class private data.

If instead we use a singly linked list of GtkWidgetAction, each subclass
has their own "head" yet all subclasses share the tail of the
GtkWidgetAction chain.

This creates one bit of complexity though. You need a stable way to know
which "bit" is the "enabled" bit of the action so we can track enabled
GAction state. That is easily solved by calculating the distance to the
end of the chain for a given action so that base classes sort ahead of
subclasses. Since the parent class always knows its parent's actions, the
position is stable.

A new dynamic bitarray helper also helps us avoid allocations in all the
current cases (up to 64 actions per widget) and dynamically switches to
malloc if that is to ever be exceeded.
2020-03-20 11:17:56 -07:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Emmanuele Bassi
b28da74e90 gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-18 23:00:51 -04:00
Alexander Larsson
2890cd849f profiler: Add _end_mark() version of _add_mark()
These don't take a duration, instead they call g_get_monotonic_time() to
and subtract the start time for it.

Almost all our calls are like this, and this makes the callsites clearer
and avoids inlining the clock call into the call site.
2020-02-12 11:25:34 +01:00
Alexander Larsson
01d5ad2056 profiler: Make profiler-is-running a macro
When we use if (GDK_PROFILER_IS_RUNNING) this means we get an
inlined if (FALSE) when the compiler support is not compiled in, which
gets rid of all the related code completely.

We also expand to  G_UNLIKELY(gdk_profiler_is_running ()) in the supported
case which might cause somewhat better code generation.
2020-02-12 11:05:01 +01:00
Alexander Larsson
cc643df88b Convert all profiler times from nsec to usec
usec is the scale of the monotonic timer which is where we get almost
all the times from. The only actual source of nsec is the opengl
GPU time (but who knows what the actual resulution of that is).

Changing this to usec allows us to get rid of " * 1000" in a *lot* of
places all over the codebase, which are ugly and confusing.
2020-02-12 10:44:17 +01:00
Benjamin Otte
bfebc2b01a icontheme: Remove gtk_icon_theme_get_default()
The API encouraged wrong usage - most of the users were indeed wrong.

Use the correct version instead:
  gtk_icon_theme_get_for_display (gtk_widget_get_display ())
2020-02-04 16:41:36 +01:00
Matthias Clasen
75c73ac3cd Merge branch 'robertroth/shortcuts-overlay-accel' into 'master'
Application: Do not reuse Ctrl+F1 for help-overlay

See merge request GNOME/gtk!307
2020-01-29 10:25:40 +00:00
Matthias Clasen
64e026d0a9 Revert "Ensure icon themes are loaded with other themes"
This reverts commit 88d26b7549.

This change caused GtkShortcutWindow to not work anymore,
and we are fixing icon themes differently, anyway.
2020-01-25 14:32:01 -05:00
Matthias Clasen
88d26b7549 Ensure icon themes are loaded with other themes
Trigger icon theme loading from the code in GtkApplication
where we set up the icon theme search path. This makes
it happen before the first frame.
2020-01-22 23:44:01 -05:00
Matthias Clasen
73a214d1a9 application: Add some profiler marks
Add marks around gtk_init and application startup
helps to understand where the time before the first
frame goes.
2020-01-22 23:44:01 -05:00
Matthias Clasen
9be0b3d76f application: Stop extracting accels from menus
This functionality has been superseded by
gtk_application_set_accels_for_action in GTK3,
and we don't want to carry it forward in GTK4.
2019-06-21 22:47:40 -04:00
Matthias Clasen
ef031e1a9d Allow registering actions per-class
Add a facility to register and install actions
at class init time. The intended use for these
actions is for

a) context and other model-based menus
b) key bindings

Most of these actions are going to be stateless,
so add separate apis for the simple and stateful
cases.

We avoid creating an action group for these by
teaching the action muxer about these actions.
The action muxer also maintains the enabled
state for these actions.
2019-06-18 14:47:33 -04:00
Matthias Clasen
9b62da10e6 Give the action muxer a widget
This will be used in the future to obtain
widget class actions.
2019-06-18 06:12:50 -04:00
Christian Hergert
4a954a9a1c gtkapplication: track changes to profiler D-Bus API
Recently, to make things more forward-portable, Sysprof and Mutter altered
the API for org.gnome.Sysprof3.Profiler. This tracks those changes.
2019-06-06 17:24:33 -07:00
Christian Hergert
bd26cce812 gtk: rely on default marshallers
Similar to previous removals of g_cclosure_marshal_VOID__VOID we can remove
other marshallers for which are a simple G_TYPE_NONE with single parameter.
In those cases, GLib will setup both a c_marshaller and va_marshaller for
us. Before this commit, we would not get a va_marshaller because the
c_marshaller is set.

Related to GNOME/Initiatives#10
2019-05-30 20:56:50 -07:00
Matthias Clasen
68f2cd1f09 Trivial: Remove a few +'s 2019-05-19 15:29:04 +00:00
Matthias Clasen
599806ca82 Try again to fix profiler setup
We were trying to store the profiler_id
in a struct that does not exist at the time.
Store it somewhere else.
2019-05-14 20:09:44 +00:00
Matthias Clasen
c009611401 Fix registration of profiler DBus api 2019-05-14 12:06:55 +00:00
Matthias Clasen
cb51699098 profiler: Update the D-Bus interface name
Sysprof is bumping its name to Sysprof3, so
lets change to that before this gets used.
2019-05-08 16:49:47 +00:00
Matthias Clasen
18127be3bd GtkApplication: Add a profiler dbus api
Implement the org.gnome.Sysprof2.Profiler D-Bus
api to let sysprof start and stop tracing at runtime,
and get the data directly, via a passed fd.
2019-05-07 09:37:59 -07:00
Matthias Clasen
d006ee65f5 application: Add a query-end signal
This lets us take just-in-time inhibitors, and makes
the session support a little more real.
2019-02-19 00:56:31 -05:00
Emmanuele Bassi
1668496359 docs: Fix GTK links and locations 2019-02-06 10:39:27 +01:00
Timm Bäder
8de1ba2cc4 application: Remove dead assignment 2018-12-04 06:30:47 +01:00
Matthias Clasen
2bb97bc136 GtkApplication: Improve the docs
Expand the docs for ::register-session a bit.
2018-08-31 13:38:01 -04:00
Matthias Clasen
b82a32676b GtkApplication: track screensaver state
A number of applications want to track the state of the screensaver.
Make this information available as a boolean property. We only listen
for state changes when ::register-session is set to TRUE.

This is implemented for unsandboxed D-Bus access by talking
directly to org.gnome.ScreenSaver or org.freedesktop.ScreenSaver,
and for sandboxed D-Bus by using a (new) portal API.
A Quartz implementation is missing.
2018-08-30 22:53:36 -04:00
Daniel Boles
4b96e7fc78 Application: Do not reuse Ctrl+F1 for help-overlay
It just gets overridden to do something else, as the 1st GtkWidget’s
class_init() adds it as a binding to toggle tooltips with the keyboard.
The last entity to hook it (& return TRUE) is the only one who gets it.

So, worse: If users needed to manually set accels for a ShortcutsWindow,
coincidentally waited until after the 1st GtkWidget init() to do it, &
copied what GtkApplication said in an attempt to be good & consistent —
they inadvertently broke the keyboard tooltips (except for users with a
GDK_KEY_KP_F1 – whatever that is) as their handler blocked GtkWidget’s.

So, one side has to drop this accelerator, and it seems clear that being
able to open tooltips with the keyboard is more important than having a
second accel for the help-overlay. We can make up a replacement later.

https://gitlab.gnome.org/GNOME/gtk/issues/626
2018-08-24 14:51:21 +03:00
Timm Bäder
6b4709ea3c GtkApplication: Remove priv pointer 2018-07-08 09:41:15 +02:00
Mario Sanchez Prada
07d6c53346 application: Complete startup notification sequence for remote invocations
When a remote instance of a GTK application implementing the Startup
Notification protocol gets spawned it will pass the startup sequence
ID as "platform data" to the main instance. Thus, we need to make sure
that the startup sequence gets completed in that case, since the remote
instance won't do it by itself, since it won't map any top level window.

Checking for this "platform data" in the implementation of the after_emit()
virtual method in the primary instance should be a good place to do so, since
the existence of such data proves that a remote instance has been spawned.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +01:00
Mario Sanchez Prada
479c341545 application: Use the new API to get the startup notification ID
The DESKTOP_STARTUP_ID gets cleared early after the process is spawned,
meaning that it's too late at add_platform_data() to pick it up and send
it over to the primary instance, as it will be always unset at that point.

To solve this, we use the new gdk_display_get_startup_notification_id()
method to pull the startup notification ID for the application, if present,
out of the display and pass it over to that primary instance.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
888dfe499d Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00