fix: calling of X11 functions when running under Wayland (#33355)
* fix: don't call X11 functions in file dialog and message box * refactor: remove unused GtkUiPlatform declaration * fix: set gtk darktheme only when running under X11 * fix: replace X11 window state watcher with implementation using ozone * fix: make sure global menu barr is used only when supported * fix: don't call X11 function in native window views under wayland * style: fix lint issues * fix: use GtkUiPlatform::ShowGtkWindow instead of gtk_window_present directly * refactor: extract CreateGlobalMenuBar into separate function * refactor: move checking for WaylandWindowDecorations inside class * fix: check if we run under X11 only in ozone build * refactor: drop including unused ui/base/ui_base_features.h header * fix: modify ui_gtk_public_header.patch to also export gtk_ui.h * fix: refactor guarding of X11 calls - Introduce patch exposing new electron_can_call_x11 property - Replace defined(USE_OZONE) with BUILDFLAG(OZONE_PLATFORM_X11) flags * fix: remove the last remaining usage of USE_X11 * fix: usage of BUILDFLAG(OZONE_PLATFORM_X11) not building on non ozone * fix: call UpdateWindowState from OnBoundsChanged only under X11
This commit is contained in:
parent
1153a5ce5a
commit
cdf2b3f4e4
16 changed files with 305 additions and 309 deletions
|
@ -114,3 +114,4 @@ port_autofill_colors_to_the_color_pipeline.patch
|
|||
build_disable_partition_alloc_on_mac.patch
|
||||
fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
|
||||
build_make_libcxx_abi_unstable_false_for_electron.patch
|
||||
introduce_ozoneplatform_electron_can_call_x11_property.patch
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Marek Rusinowski <marekrusinowski@gmail.com>
|
||||
Date: Wed, 23 Mar 2022 21:09:37 +0100
|
||||
Subject: introduce OzonePlatform::electron_can_call_x11 property
|
||||
|
||||
We expose this additonal property in the OzonePlatform to be able to easily
|
||||
determine whatever we can call X11 functions without crashing the application
|
||||
at rutime. It would be best if eventually all usages of this property were
|
||||
replaced with clean ozone native implementations.
|
||||
|
||||
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc
|
||||
index 9008af973427d7dab8170449bc5767cebc9d2e9e..e312287e4aca61b51a69c8413088f56f9f704b5e 100644
|
||||
--- a/ui/ozone/platform/x11/ozone_platform_x11.cc
|
||||
+++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
|
||||
@@ -200,6 +200,7 @@ class OzonePlatformX11 : public OzonePlatform,
|
||||
properties->supports_vulkan_swap_chain = true;
|
||||
properties->uses_external_vulkan_image_factory = true;
|
||||
properties->skia_can_fall_back_to_x11 = true;
|
||||
+ properties->electron_can_call_x11 = true;
|
||||
properties->platform_shows_drag_image = false;
|
||||
properties->supports_global_application_menus = true;
|
||||
properties->app_modal_dialogs_use_event_blocker = true;
|
||||
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h
|
||||
index 22ba32317a74df24249d1528dcaaa28ff18bd0f4..fa57f97520a0327be2c7f5179591ca61b801c8b0 100644
|
||||
--- a/ui/ozone/public/ozone_platform.h
|
||||
+++ b/ui/ozone/public/ozone_platform.h
|
||||
@@ -132,6 +132,10 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
|
||||
// Linux only: determines if Skia can fall back to the X11 output device.
|
||||
bool skia_can_fall_back_to_x11 = false;
|
||||
|
||||
+ // Linux only: determines is Electron can call selected X11 functions while
|
||||
+ // it migrates to pure ozone abstractions.
|
||||
+ bool electron_can_call_x11 = false;
|
||||
+
|
||||
// Wayland only: determines whether windows which are not top level ones
|
||||
// should be given parents explicitly.
|
||||
bool set_parent_for_non_top_level_windows = false;
|
|
@ -3,22 +3,32 @@ From: deepak1556 <hop2deep@gmail.com>
|
|||
Date: Fri, 10 Apr 2020 17:47:18 -0700
|
||||
Subject: ui_gtk_public_header.patch
|
||||
|
||||
Allow electron to depend on //ui/gtk/gtk_util.h
|
||||
Allow electron to depend on gtk_util.h and gtk_ui.h from //ui/gtk/
|
||||
|
||||
diff --git a/ui/gtk/BUILD.gn b/ui/gtk/BUILD.gn
|
||||
index 4093df78da0bbb1d8df743942f364cf728ad3414..2f31d99b207ffc3531b5334b5a01239cc1fefb35 100644
|
||||
index 4093df78da0bbb1d8df743942f364cf728ad3414..2f7c404307bfebb0e2890148cf9b0d6d9c68094f 100644
|
||||
--- a/ui/gtk/BUILD.gn
|
||||
+++ b/ui/gtk/BUILD.gn
|
||||
@@ -69,7 +69,7 @@ generate_stubs("gtk_stubs") {
|
||||
@@ -69,7 +69,11 @@ generate_stubs("gtk_stubs") {
|
||||
}
|
||||
|
||||
component("gtk") {
|
||||
- public = [ "gtk_ui_factory.h" ]
|
||||
+ public = [ "gtk_ui_factory.h", "gtk_util.h" ]
|
||||
+ public = [
|
||||
+ "gtk_ui.h",
|
||||
+ "gtk_ui_factory.h",
|
||||
+ "gtk_util.h",
|
||||
+ ]
|
||||
|
||||
sources = [
|
||||
"gtk_color_mixers.cc",
|
||||
@@ -85,7 +85,6 @@ component("gtk") {
|
||||
@@ -79,13 +83,11 @@ component("gtk") {
|
||||
"gtk_key_bindings_handler.cc",
|
||||
"gtk_key_bindings_handler.h",
|
||||
"gtk_ui.cc",
|
||||
- "gtk_ui.h",
|
||||
"gtk_ui_factory.cc",
|
||||
"gtk_ui_platform.h",
|
||||
"gtk_ui_platform_stub.cc",
|
||||
"gtk_ui_platform_stub.h",
|
||||
"gtk_util.cc",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue