[x11] Implement _GTK_SHOW_WINDOW_MENU.

BUG: 454756
This commit is contained in:
Emilio Cobos Álvarez 2022-06-07 12:29:59 +02:00 committed by Vlad Zahorodnii
parent fefd730273
commit 7e1617c280
4 changed files with 19 additions and 1 deletions

View file

@ -100,7 +100,8 @@ RootInfo *RootInfo::create()
| NET::WM2FullscreenMonitors | NET::WM2FullscreenMonitors
| NET::WM2KDEShadow | NET::WM2KDEShadow
| NET::WM2OpaqueRegion | NET::WM2OpaqueRegion
| NET::WM2GTKFrameExtents; | NET::WM2GTKFrameExtents
| NET::WM2GTKShowWindowMenu;
#if KWIN_BUILD_ACTIVITIES #if KWIN_BUILD_ACTIVITIES
properties2 |= NET::WM2Activities; properties2 |= NET::WM2Activities;
#endif #endif
@ -216,6 +217,14 @@ void RootInfo::moveResizeWindow(xcb_window_t w, int flags, int x, int y, int wid
} }
} }
void RootInfo::showWindowMenu(xcb_window_t w, int device_id, int x_root, int y_root)
{
Q_UNUSED(device_id);
if (X11Window *c = Workspace::self()->findClient(Predicate::WindowMatch, w)) {
c->GTKShowWindowMenu(x_root, y_root);
}
}
void RootInfo::gotPing(xcb_window_t w, xcb_timestamp_t timestamp) void RootInfo::gotPing(xcb_window_t w, xcb_timestamp_t timestamp)
{ {
if (X11Window *c = Workspace::self()->findClient(Predicate::WindowMatch, w)) { if (X11Window *c = Workspace::self()->findClient(Predicate::WindowMatch, w)) {

View file

@ -42,6 +42,7 @@ protected:
void closeWindow(xcb_window_t w) override; void closeWindow(xcb_window_t w) override;
void moveResize(xcb_window_t w, int x_root, int y_root, unsigned long direction) override; void moveResize(xcb_window_t w, int x_root, int y_root, unsigned long direction) override;
void moveResizeWindow(xcb_window_t w, int flags, int x, int y, int width, int height) override; void moveResizeWindow(xcb_window_t w, int flags, int x, int y, int width, int height) override;
void showWindowMenu(xcb_window_t w, int device_id, int x_root, int y_root) override;
void gotPing(xcb_window_t w, xcb_timestamp_t timestamp) override; void gotPing(xcb_window_t w, xcb_timestamp_t timestamp) override;
void restackWindow(xcb_window_t w, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp) override; void restackWindow(xcb_window_t w, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp) override;
void changeShowingDesktop(bool showing) override; void changeShowingDesktop(bool showing) override;

View file

@ -4077,6 +4077,13 @@ void X11Window::NETMoveResizeWindow(int flags, int x, int y, int width, int heig
configureRequest(value_mask, x, y, width, height, gravity, true); configureRequest(value_mask, x, y, width, height, gravity, true);
} }
// _GTK_SHOW_WINDOW_MENU
void X11Window::GTKShowWindowMenu(int x_root, int y_root)
{
QPoint globalPos(x_root, y_root);
workspace()->showWindowMenu(QRect(globalPos, globalPos), this);
}
bool X11Window::isMovable() const bool X11Window::isMovable() const
{ {
if (!hasNETSupport() && !m_motif.move()) { if (!hasNETSupport() && !m_motif.move()) {

View file

@ -236,6 +236,7 @@ public:
void NETMoveResize(int x_root, int y_root, NET::Direction direction); void NETMoveResize(int x_root, int y_root, NET::Direction direction);
void NETMoveResizeWindow(int flags, int x, int y, int width, int height); void NETMoveResizeWindow(int flags, int x, int y, int width, int height);
void GTKShowWindowMenu(int x_root, int y_root);
void restackWindow(xcb_window_t above, int detail, NET::RequestSource source, xcb_timestamp_t timestamp, void restackWindow(xcb_window_t above, int detail, NET::RequestSource source, xcb_timestamp_t timestamp,
bool send_event = false); bool send_event = false);