modules/graphics/src/main/native-glass/gtk/glass_window.cpp
Print this page
*** 118,127 ****
--- 118,129 ----
} else {
stateChangeEvent = com_sun_glass_events_WindowEvent_RESTORE;
}
notify_state(stateChangeEvent);
+ } else if (event->changed_mask & GDK_WINDOW_STATE_ABOVE) {
+ notify_on_top( event->new_window_state & GDK_WINDOW_STATE_ABOVE);
}
}
void WindowContextBase::process_focus(GdkEventFocus* event) {
if (!event->in && WindowContextBase::sm_mouse_drag_window == this) {
*** 817,842 ****
void WindowContextTop::process_net_wm_property() {
// Workaround for https://bugs.launchpad.net/unity/+bug/998073
static GdkAtom atom_atom = gdk_atom_intern_static_string("ATOM");
static GdkAtom atom_net_wm_state_hidden = gdk_atom_intern_static_string("_NET_WM_STATE_HIDDEN");
gint length;
GdkAtom* atoms = NULL;
if (gdk_property_get(gdk_window, atom_net_wm_state, atom_atom,
0, G_MAXLONG, FALSE, NULL, NULL, &length, (guchar**) &atoms)) {
gint i = 0;
bool is_hidden = false;
while (i < length) {
if (atom_net_wm_state_hidden == atoms[i]) {
is_hidden = true;
! break;
}
-
i++;
}
g_free(atoms);
--- 819,846 ----
void WindowContextTop::process_net_wm_property() {
// Workaround for https://bugs.launchpad.net/unity/+bug/998073
static GdkAtom atom_atom = gdk_atom_intern_static_string("ATOM");
static GdkAtom atom_net_wm_state_hidden = gdk_atom_intern_static_string("_NET_WM_STATE_HIDDEN");
+ static GdkAtom atom_net_wm_state_above = gdk_atom_intern_static_string("_NET_WM_STATE_ABOVE");
gint length;
GdkAtom* atoms = NULL;
if (gdk_property_get(gdk_window, atom_net_wm_state, atom_atom,
0, G_MAXLONG, FALSE, NULL, NULL, &length, (guchar**) &atoms)) {
gint i = 0;
bool is_hidden = false;
+ bool is_above = false;
while (i < length) {
if (atom_net_wm_state_hidden == atoms[i]) {
is_hidden = true;
! } else if (atom_net_wm_state_above == atoms[i]) {
! is_above = true;
}
i++;
}
g_free(atoms);
*** 845,854 ****
--- 849,860 ----
notify_state((is_hidden)
? com_sun_glass_events_WindowEvent_MINIMIZE
: com_sun_glass_events_WindowEvent_RESTORE);
}
+
+ notify_on_top(is_above);
}
}
void WindowContextTop::process_property_notify(GdkEventProperty* event) {
if (event->atom == atom_net_wm_state && event->window == gdk_window) {
*** 1340,1349 ****
--- 1346,1380 ----
o = topO->owner;
}
return false;
}
+ bool WindowContextTop::effective_on_top() {
+ if (owner) {
+ WindowContextTop* topO = dynamic_cast<WindowContextTop*>(owner);
+ return (topO && topO->effective_on_top()) || on_top;
+ }
+ return on_top;
+ }
+
+ void WindowContextTop::notify_on_top(bool top) {
+ // Do not report effective (i.e. native) values to the FX, only if the user sets it manually
+ if (top != effective_on_top() && jwindow) {
+ if (on_top_inherited() && !top) {
+ // Disallow user's "on top" handling on windows that inherited the property
+ gtk_window_set_keep_above(GTK_WINDOW(gtk_widget), TRUE);
+ } else {
+ on_top = top;
+ update_ontop_tree(top);
+ mainEnv->CallVoidMethod(jwindow,
+ jWindowNotifyLevelChanged,
+ top ? com_sun_glass_ui_Window_Level_FLOATING : com_sun_glass_ui_Window_Level_NORMAL);
+ CHECK_JNI_EXCEPTION(mainEnv);
+ }
+ }
+ }
+
void WindowContextTop::set_level(int level) {
if (level == com_sun_glass_ui_Window_Level_NORMAL) {
on_top = false;
} else if (level == com_sun_glass_ui_Window_Level_FLOATING
|| level == com_sun_glass_ui_Window_Level_TOPMOST) {