--- old/modules/graphics/src/main/native-glass/gtk/glass_window.cpp 2014-02-04 14:46:23.527806298 +0100 +++ new/modules/graphics/src/main/native-glass/gtk/glass_window.cpp 2014-02-04 14:46:23.375806294 +0100 @@ -120,6 +120,8 @@ } notify_state(stateChangeEvent); + } else if (event->changed_mask & GDK_WINDOW_STATE_ABOVE) { + notify_on_top( event->new_window_state & GDK_WINDOW_STATE_ABOVE); } } @@ -819,6 +821,7 @@ 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; @@ -829,12 +832,13 @@ 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; - break; + } else if (atom_net_wm_state_above == atoms[i]) { + is_above = true; } - i++; } @@ -847,6 +851,8 @@ ? com_sun_glass_events_WindowEvent_MINIMIZE : com_sun_glass_events_WindowEvent_RESTORE); } + + notify_on_top(is_above); } } @@ -1342,6 +1348,31 @@ return false; } +bool WindowContextTop::effective_on_top() { + if (owner) { + WindowContextTop* topO = dynamic_cast(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;