Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8348095: [Linux] Menu shows up in wrong position when using i3 windows manager in full screen mode #1702

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkView__1getX

GlassView* view = JLONG_TO_GLASSVIEW(ptr);
if (view && view->current_window) {
return view->current_window->get_frame_extents().left;
return view->current_window->get_geometry().view_x;
}
return 0;
}
Expand All @@ -120,7 +120,7 @@ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkView__1getY

GlassView* view = JLONG_TO_GLASSVIEW(ptr);
if (view && view->current_window) {
return view->current_window->get_frame_extents().top;
return view->current_window->get_geometry().view_y;
}
return 0;
}
Expand Down
25 changes: 14 additions & 11 deletions modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,15 +973,18 @@ void WindowContextTop::process_configure(GdkEventConfigure* event) {
? event->height : wh;
}

int x, y;
gdk_window_get_origin(gdk_window, &x, &y);
if (frame_type == TITLED && !is_fullscreen) {
x -= geometry.extents.left;
y -= geometry.extents.top;
}

geometry.x = x;
geometry.y = y;
gint root_x, root_y, origin_x, origin_y;
gdk_window_get_root_origin(gdk_window, &root_x, &root_y);
gdk_window_get_origin(gdk_window, &origin_x, &origin_y);

// x and y represent the position of the top-left corner of the window relative to the desktop area
geometry.x = root_x;
geometry.y = root_y;

// view_x and view_y represent the position of the content relative to the top-left corner of the window,
// taking into account window decorations (such as title bars and borders) applied by the window manager.
geometry.view_x = origin_x - root_x;
geometry.view_y = origin_y - root_y;
notify_window_move();

glong to_screen = getScreenPtrForLocation(geometry.x, geometry.y);
Expand Down Expand Up @@ -1231,8 +1234,8 @@ GtkWindow *WindowContextTop::get_gtk_window() {
return GTK_WINDOW(gtk_widget);
}

WindowFrameExtents WindowContextTop::get_frame_extents() {
return geometry.extents;
WindowGeometry WindowContextTop::get_geometry() {
return geometry;
}

void WindowContextTop::update_ontop_tree(bool on_top) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ enum BoundsType {

struct WindowGeometry {
WindowGeometry(): final_width(), final_height(),
size_assigned(false), x(), y(), gravity_x(), gravity_y(), extents() {}
size_assigned(false), x(), y(), view_x(), view_y(), gravity_x(), gravity_y(), extents() {}
// estimate of the final width the window will get after all pending
// configure requests are processed by the window manager
struct {
Expand All @@ -86,6 +86,9 @@ struct WindowGeometry {

int x;
int y;
int view_x;
int view_y;

float gravity_x;
float gravity_y;

Expand All @@ -106,7 +109,7 @@ class WindowContext : public DeletedMemDebug<0xCC> {
virtual void commitIME(gchar *) = 0;

virtual void paint(void* data, jint width, jint height) = 0;
virtual WindowFrameExtents get_frame_extents() = 0;
virtual WindowGeometry get_geometry() = 0;

virtual void enter_fullscreen() = 0;
virtual void exit_fullscreen() = 0;
Expand Down Expand Up @@ -293,7 +296,7 @@ class WindowContextTop: public WindowContextBase {
void process_destroy();
void work_around_compiz_state();

WindowFrameExtents get_frame_extents();
WindowGeometry get_geometry();

void set_minimized(bool);
void set_maximized(bool);
Expand Down