After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720550 - Refactor GtkApplication
Refactor GtkApplication
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkApplication
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 710351 720551 720552
 
 
Reported: 2013-12-16 18:47 UTC by Allison Karlitskaya (desrt)
Modified: 2013-12-16 19:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Refactor GtkApplication (86.75 KB, patch)
2013-12-16 18:47 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2013-12-16 18:47:03 UTC
See patch.
Comment 1 Allison Karlitskaya (desrt) 2013-12-16 18:47:05 UTC
Created attachment 264314 [details] [review]
Refactor GtkApplication

gtkapplication.c has turned into a bit of an #ifdef mess over time, and
many of the current checks are incorrect.  As an example, if you build
Gtk for wayland, and exclude the X11 backend, much of the functionality
required by wayland (such as exporting menu models) will be disabled.

Solve that by introducing a backend mechanism to GtkApplication (named
GtkApplicationImpl) similar to the one in GApplication.  Add backends
for Wayland, X11 and Quartz, with X11 and Wayland sharing a common
'DBus' superclass.

                             GtkApplicationImpl
                                      |
                       /--------------+-------------------\
                       |                                  |
            GtkApplicationImplDBus              GtkApplicationImplQuartz
                       |
           /-----------+-----------------\
           |                             |
  GtkApplicationImplX11      GtkApplicationImplWayland

GtkApplicationImpl itself is essentially a bunch of vfuncs that serve as
hooks for various things that the platform-specific backends may be
interested in doing (startup, shutdown, managing windows, inhibit, etc.)

With this change, all platform specific code has been removed from
gtkapplication.c and gtkapplicationwindow.c (both of which are now free
of #ifdefs, except for a UNIX-specific use of GDesktopAppInfo in
gtkapplicationwindow.c).

Additionally, because of the movement of the property-setting code out
of GtkApplicationWindow, the _GTK_APPLICATION_ID properties (and
friends) will be set on non-GtkApplicationWindows, such as dialogs.
Comment 2 Matthias Clasen 2013-12-16 18:58:07 UTC
Review of attachment 264314 [details] [review]:

Seems that this is mostly code rearrangement.

One question is why we set window properties on realize in the X11 case, but on map in the Wayland case. In particular, since you are calling the hook at the end of map - isn't that too late ?
Comment 3 Jasper St. Pierre (not reading bugmail) 2013-12-16 19:10:42 UTC
The way gtk_surface is currently defined/implemented in mutter, it only exists for the lifetime of the xdg_surface. We can change this around in mutter, but I'd prefer to keep it as-is.
Comment 4 Allison Karlitskaya (desrt) 2013-12-16 19:13:53 UTC
Attachment 264314 [details] pushed as 7fd81cf - Refactor GtkApplication

Thanks for the quick review.