summaryrefslogtreecommitdiff
path: root/chromium/ui/gtk/x
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/gtk/x')
-rw-r--r--chromium/ui/gtk/x/BUILD.gn1
-rw-r--r--chromium/ui/gtk/x/DEPS3
-rw-r--r--chromium/ui/gtk/x/gtk_event_loop_x11.cc1
-rw-r--r--chromium/ui/gtk/x/gtk_ui_delegate_x11.cc39
-rw-r--r--chromium/ui/gtk/x/gtk_ui_delegate_x11.h7
5 files changed, 36 insertions, 15 deletions
diff --git a/chromium/ui/gtk/x/BUILD.gn b/chromium/ui/gtk/x/BUILD.gn
index 9cdf6607336..f773ee3ced9 100644
--- a/chromium/ui/gtk/x/BUILD.gn
+++ b/chromium/ui/gtk/x/BUILD.gn
@@ -21,6 +21,7 @@ component("x") {
"//ui/base",
"//ui/events/platform/x11",
"//ui/gfx/x",
+ "//ui/platform_window/x11",
]
public_deps = [ "//ui/gtk:gtk_ui_delegate" ]
defines = [ "IS_UI_GTK_X_IMPL" ]
diff --git a/chromium/ui/gtk/x/DEPS b/chromium/ui/gtk/x/DEPS
new file mode 100644
index 00000000000..098786a5764
--- /dev/null
+++ b/chromium/ui/gtk/x/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+ui/platform_window/x11",
+]
diff --git a/chromium/ui/gtk/x/gtk_event_loop_x11.cc b/chromium/ui/gtk/x/gtk_event_loop_x11.cc
index abda48cbf04..efec73ec9ce 100644
--- a/chromium/ui/gtk/x/gtk_event_loop_x11.cc
+++ b/chromium/ui/gtk/x/gtk_event_loop_x11.cc
@@ -96,7 +96,6 @@ void GtkEventLoopX11::ProcessGdkEventKey(const GdkEventKey& gdk_event_key) {
// XProto.
int state =
BuildXkbStateFromGdkEvent(gdk_event_key.state, gdk_event_key.group);
- event.xlib_event().xkey.state = state;
event.As<x11::KeyEvent>()->state = static_cast<x11::KeyButMask>(state);
// We want to process the gtk event; mapped to an X11 event immediately
diff --git a/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc b/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc
index 8ae0f44fe54..16a3ae2e7ae 100644
--- a/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc
+++ b/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc
@@ -8,15 +8,19 @@
#include <gtk/gtk.h>
#include "base/check.h"
+#include "ui/base/x/x11_util.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/x/x11.h"
+#include "ui/gfx/x/xproto.h"
#include "ui/gtk/x/gtk_event_loop_x11.h"
+#include "ui/platform_window/x11/x11_window.h"
+#include "ui/platform_window/x11/x11_window_manager.h"
namespace ui {
-GtkUiDelegateX11::GtkUiDelegateX11(XDisplay* display) : xdisplay_(display) {
- DCHECK(xdisplay_);
+GtkUiDelegateX11::GtkUiDelegateX11(x11::Connection* connection)
+ : connection_(connection) {
+ DCHECK(connection_);
gdk_set_allowed_backends("x11");
}
@@ -45,16 +49,28 @@ GdkWindow* GtkUiDelegateX11::GetGdkWindow(gfx::AcceleratedWidget window_id) {
bool GtkUiDelegateX11::SetGdkWindowTransientFor(GdkWindow* window,
gfx::AcceleratedWidget parent) {
- XSetTransientForHint(xdisplay_, GDK_WINDOW_XID(window),
- static_cast<uint32_t>(parent));
+ SetProperty(static_cast<x11::Window>(GDK_WINDOW_XID(window)),
+ x11::Atom::WM_TRANSIENT_FOR, x11::Atom::WINDOW, parent);
+
+ ui::X11Window* parent_window =
+ ui::X11WindowManager::GetInstance()->GetWindow(parent);
+ parent_window->SetTransientWindow(
+ static_cast<x11::Window>(gdk_x11_window_get_xid(window)));
+
return true;
}
+void GtkUiDelegateX11::ClearTransientFor(gfx::AcceleratedWidget parent) {
+ ui::X11Window* parent_window =
+ ui::X11WindowManager::GetInstance()->GetWindow(parent);
+ // parent_window might be dead if there was a top-down window close
+ if (parent_window)
+ parent_window->SetTransientWindow(x11::Window::None);
+}
+
GdkDisplay* GtkUiDelegateX11::GetGdkDisplay() {
- if (!display_) {
- GdkDisplay* display = gdk_x11_lookup_xdisplay(xdisplay_);
- display_ = !display ? gdk_display_get_default() : display;
- }
+ if (!display_)
+ display_ = gdk_display_get_default();
return display_;
}
@@ -62,8 +78,9 @@ void GtkUiDelegateX11::ShowGtkWindow(GtkWindow* window) {
// We need to call gtk_window_present after making the widgets visible to make
// sure window gets correctly raised and gets focus.
DCHECK(X11EventSource::HasInstance());
- gtk_window_present_with_time(window,
- X11EventSource::GetInstance()->GetTimestamp());
+ gtk_window_present_with_time(
+ window,
+ static_cast<uint32_t>(X11EventSource::GetInstance()->GetTimestamp()));
}
} // namespace ui
diff --git a/chromium/ui/gtk/x/gtk_ui_delegate_x11.h b/chromium/ui/gtk/x/gtk_ui_delegate_x11.h
index e1f252df708..730af74ed73 100644
--- a/chromium/ui/gtk/x/gtk_ui_delegate_x11.h
+++ b/chromium/ui/gtk/x/gtk_ui_delegate_x11.h
@@ -7,7 +7,7 @@
#include "base/component_export.h"
#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/x/x11_types.h"
+#include "ui/gfx/x/connection.h"
#include "ui/gtk/gtk_ui_delegate.h"
using GdkDisplay = struct _GdkDisplay;
@@ -21,7 +21,7 @@ namespace ui {
// Ozone is completed.
class COMPONENT_EXPORT(UI_GTK_X) GtkUiDelegateX11 : public GtkUiDelegate {
public:
- explicit GtkUiDelegateX11(XDisplay* display);
+ explicit GtkUiDelegateX11(x11::Connection* connection);
GtkUiDelegateX11(const GtkUiDelegateX11&) = delete;
GtkUiDelegateX11& operator=(const GtkUiDelegateX11&) = delete;
~GtkUiDelegateX11() override;
@@ -32,12 +32,13 @@ class COMPONENT_EXPORT(UI_GTK_X) GtkUiDelegateX11 : public GtkUiDelegate {
GdkWindow* GetGdkWindow(gfx::AcceleratedWidget window_id) override;
bool SetGdkWindowTransientFor(GdkWindow* window,
gfx::AcceleratedWidget parent) override;
+ void ClearTransientFor(gfx::AcceleratedWidget parent) override;
void ShowGtkWindow(GtkWindow* window) override;
private:
GdkDisplay* GetGdkDisplay();
- XDisplay* const xdisplay_;
+ x11::Connection* const connection_;
GdkDisplay* display_ = nullptr;
};