Chromium anf GTK3 dependencies on X11

179 views
Skip to first unread message

Lionel Chazallon

unread,
Oct 31, 2017, 2:05:37 AM10/31/17
to Chromium-dev
Hi,

I have been recently trying to use chromium and libGTK3 with ozone backend on an embedded platform which only has a wayland environement (No X11).

Even if i successfully built libgtk3 on the same device, it seems that the /browser/chromium/ui/libgtkui still depends heavily on X11 headers.
This is kinda sad as one of the main things about libGTK3 is that you can use it with different backends (and without X11).

Is there any plan to make the libgtkui chromium module use the libGTK functions that allow to abstract the backend ? 

I have been able to reproduce the same issue building on an ubuntu 17.10.

Thanks,

Lionel.

Antonio Gomes

unread,
Oct 31, 2017, 11:10:09 AM10/31/17
to long...@hotmail.com, Chromium-dev, Tom Anderson
/cc tom anderson
As far as I know, the Gtk specific LinuxUI object is instantiated in

69 void ChromeBrowserMainExtraPartsViewsLinux::PreEarlyInitialization() {
70 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port.
71 views::LinuxUI* gtk2_ui = BuildGtkUi();
72 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow));
73 views::LinuxUI::SetInstance(gtk2_ui);
74 }

... which is a code path that OZONE builds do *not* take:

912 #if defined(TOOLKIT_VIEWS)
913 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(USE_OZONE)
914 main_parts->AddParts(new ChromeBrowserMainExtraPartsViewsLinux());
915 #else
916 main_parts->AddParts(new ChromeBrowserMainExtraPartsViews());
917 #endif
918 #endif

what is more, although Gtk3 has builtin Wayland support, it does not
necessarily mean Chrome built with Gtk3+Wayland will just work
(without X11). Gtk is used for specific bits within Chrome (theming,
some dialogs, IIRC), whereas Aura is the Graphics toolkip that Chrome
uses. Aura itself relies on X11 for Chrome/Linux (officially).

You seem to need Ozone/Wayland backend for Chrome, which is being
worked out offtrunk (for now): https://github.com/Igalia/chromium/.

More questions:

- How are you building (GN args, etc)?

- What is your Chromium checkout baseline?


--
--Antonio Gomes

LongChair .

unread,
Oct 31, 2017, 12:13:29 PM10/31/17
to Antonio Gomes, Chromium-dev, Tom Anderson
Hello,

Ok maybe i should have startesd with my setup.
I am actually trying to build electron so that it runs on Wayland.

Electron uses libchromiumcontent ( https://github.com/electron/libchromiumcontent), which will be based on chromium 61 shortly.
Electron doesn't normally use ozone as it's delivered for X11 / Win / OSX.

So I basically added the 'use_ozone=true' glag and that seems to build it.
It will build both static and share library, and the args used are in the according files here :  https://github.com/electron/libchromiumcontent/tree/master/chromiumcontent/args which is where i added the ozone flags.

What happens when i build it is that libchromium content includes the libgtkui as you will see here : https://github.com/electron/libchromiumcontent/blob/master/chromiumcontent/BUILD.gn#L37

When i build with ozone, the NativeEvent struct gets defined to void * here : https://chromium.googlesource.com/chromium/src.git/+/master/base/event_types.h#32
and then starts the troubles with all the access call to this struct that say basically that void* doesn't have any member.

But quite a bunch of modules in libgtkui seem indeed to be requiring X11 headers and that could be a problem.
I know that ozone is out of tree, but that's not really an ozone related issue :)

But still it would be nice to be able to build libgtk3ui in a way that make it not X11 dependent.

if you have any good suggestions for me to work this around, i'll be happy to hear them :)

Lionel.
Reply all
Reply to author
Forward
0 new messages