Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0859d2

Browse files
author
Thiago M Sayao
committedFeb 25, 2022
Fix is_visible()
1 parent 6d737f6 commit c0859d2

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed
 

‎modules/javafx.graphics/src/main/native-glass/gtk/GlassApplication.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ static gboolean x11_event_source_dispatch(GSource* source, GSourceFunc callback,
152152
// case ConfigureRequest:
153153
// g_print("============> X11 Configure Request\n");
154154
// break;
155+
case VisibilityNotify:
156+
ctx->process_visibility(&xevent.xvisibility);
157+
break;
155158
case ConfigureNotify:
156159
g_print("X11 Configure\n");
157160
ctx->process_configure(&xevent.xconfigure);

‎modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp

+16-9
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ void WindowContextBase::process_state(GdkEventWindowState* event) {
140140
}
141141
}
142142

143+
void WindowContextBase::process_visibility(XVisibilityEvent* event) {
144+
visibility_state = event->state;
145+
}
146+
143147
void WindowContextBase::process_focus(GdkEventFocus* event) {
144148
}
145149

@@ -611,13 +615,16 @@ void WindowContextBase::set_visible(bool visible) {
611615
}
612616

613617
bool WindowContextBase::is_visible() {
614-
XWindowAttributes xattr;
615-
if (XGetWindowAttributes(display, xwindow, &xattr)) {
616-
return !(xattr.map_state == IsUnmapped);
617-
}
618+
// XWindowAttributes xattr;
619+
// if (XGetWindowAttributes(display, xwindow, &xattr)) {
620+
// return !(xattr.map_state == IsUnmapped);
621+
// }
618622
// return gtk_widget_get_visible(gtk_widget);
623+
// if (!map_received) {
624+
// return false;
625+
// }
619626

620-
return false;
627+
return (visibility_state != VisibilityFullyObscured);
621628
}
622629

623630
bool WindowContextBase::set_view(jobject view) {
@@ -1140,10 +1147,10 @@ void WindowContextTop::process_configure(XConfigureEvent* event) {
11401147
updateWindowConstraints = true;
11411148
if (!frame_extents_initialized && !is_null_extents()) {
11421149
frame_extents_initialized = true;
1143-
set_bounds(0, 0, false, false,
1144-
requested_bounds.width, requested_bounds.height,
1145-
requested_bounds.client_width, requested_bounds.client_height
1146-
);
1150+
// set_bounds(0, 0, false, false,
1151+
// requested_bounds.width, requested_bounds.height,
1152+
// requested_bounds.client_width, requested_bounds.client_height
1153+
// );
11471154
}
11481155
}
11491156
} else {

‎modules/javafx.graphics/src/main/native-glass/gtk/glass_window.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class WindowContext {
180180
virtual void process_mouse_cross(XCrossingEvent*) = 0;
181181
virtual void process_key(GdkEventKey*) = 0;
182182
virtual void process_state(GdkEventWindowState*) = 0;
183+
virtual void process_visibility(XVisibilityEvent*) = 0;
183184

184185
virtual void notify_state(jint) = 0;
185186
virtual void notify_on_top(bool) {}
@@ -225,6 +226,7 @@ class WindowContextBase: public WindowContext {
225226

226227
GdkWMFunction gdk_windowManagerFunctions;
227228

229+
int visibility_state;
228230
bool is_iconified;
229231
bool is_maximized;
230232
bool is_mouse_entered;
@@ -290,7 +292,7 @@ class WindowContextBase: public WindowContext {
290292
void process_mouse_cross(XCrossingEvent*);
291293
void process_key(GdkEventKey*);
292294
void process_state(GdkEventWindowState*);
293-
295+
void process_visibility(XVisibilityEvent*);
294296
void notify_state(jint);
295297

296298
void increment_events_counter();

0 commit comments

Comments
 (0)
Please sign in to comment.