< prev index next >

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

Print this page




  65     }
  66     if (mask & com_sun_glass_ui_gtk_GtkWindow_MINIMIZABLE) {
  67         func |= GDK_FUNC_MINIMIZE;
  68     }
  69 
  70     return (GdkWMFunction) func;
  71 }
  72 
  73 extern "C" {
  74 
  75 /*
  76  * Class:     com_sun_glass_ui_gtk_GtkWindow
  77  * Method:    _createWindow
  78  * Signature: (JJI)J
  79  */
  80 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1createWindow
  81   (JNIEnv * env, jobject obj, jlong owner, jlong screen, jint mask)
  82 {
  83     (void)env;
  84 


  85     WindowContext* ctx = new WindowContextTop(obj,
  86             (WindowContext*)JLONG_TO_PTR(owner),
  87             screen,
  88             glass_mask_to_window_frame_type(mask),
  89             glass_mask_to_window_type(mask),
  90             glass_mask_to_wm_function(mask)
  91             );
  92 
  93     return PTR_TO_JLONG(ctx);
  94 }
  95 
  96 /*
  97  * Class:     com_sun_glass_ui_gtk_GtkWindow
  98  * Method:    _createChildWindow
  99  * Signature: (J)J
 100  */
 101 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1createChildWindow
 102   (JNIEnv * env, jobject obj , jlong owner)
 103 {
 104     (void)env;
 105 
 106     GdkWindow *parent_window = NULL;
 107     GtkWidget *parent_widget = NULL;
 108     WindowContextPlug *parent_ctx = NULL;
 109     WindowContext *ctx = NULL;
 110 


 111     parent_window = gdk_x11_window_lookup_for_display(
 112                         gdk_display_get_default(),
 113                         (GdkNativeWindow)PTR_TO_JLONG(owner));
 114 
 115     if (parent_window != NULL) {
 116         parent_ctx = (WindowContextPlug *)g_object_get_data(G_OBJECT(parent_window), GDK_WINDOW_DATA_CONTEXT);
 117         // HACK: do not use get_gtk_window()
 118         // the method is intended to return GtkWindow that can be used for FileChooser
 119         // (OK, that's also a hack, but still...)
 120         if (parent_ctx != NULL) {
 121             parent_widget = GTK_WIDGET(parent_ctx->get_gtk_window());
 122         }
 123     }
 124 
 125     if (parent_widget == NULL) {
 126         // If 'owner' is a bad handle, then the child window is created unparented
 127         ctx = new WindowContextPlug(obj, JLONG_TO_PTR(owner));
 128     } else {
 129         ctx = new WindowContextChild(obj,
 130                         JLONG_TO_PTR(owner),
 131                         parent_ctx->gtk_container,
 132                         parent_ctx);
 133     }




  65     }
  66     if (mask & com_sun_glass_ui_gtk_GtkWindow_MINIMIZABLE) {
  67         func |= GDK_FUNC_MINIMIZE;
  68     }
  69 
  70     return (GdkWMFunction) func;
  71 }
  72 
  73 extern "C" {
  74 
  75 /*
  76  * Class:     com_sun_glass_ui_gtk_GtkWindow
  77  * Method:    _createWindow
  78  * Signature: (JJI)J
  79  */
  80 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1createWindow
  81   (JNIEnv * env, jobject obj, jlong owner, jlong screen, jint mask)
  82 {
  83     (void)env;
  84 
  85     WindowContext* parent = JLONG_TO_WINDOW_CTX(owner);
  86 
  87     WindowContext* ctx = new WindowContextTop(obj,
  88             parent,
  89             screen,
  90             glass_mask_to_window_frame_type(mask),
  91             glass_mask_to_window_type(mask),
  92             glass_mask_to_wm_function(mask)
  93             );
  94 
  95     return PTR_TO_JLONG(ctx);
  96 }
  97 
  98 /*
  99  * Class:     com_sun_glass_ui_gtk_GtkWindow
 100  * Method:    _createChildWindow
 101  * Signature: (J)J
 102  */
 103 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1createChildWindow
 104   (JNIEnv * env, jobject obj , jlong owner)
 105 {
 106     (void)env;
 107 
 108     GdkWindow *parent_window = NULL;
 109     GtkWidget *parent_widget = NULL;
 110     WindowContextPlug *parent_ctx = NULL;
 111     WindowContext *ctx = NULL;
 112 
 113     WindowContext* parent = JLONG_TO_WINDOW_CTX(owner);
 114 
 115     parent_window = gdk_x11_window_lookup_for_display(
 116                         gdk_display_get_default(),
 117                         GDK_WINDOW_XID(ctx->get_gdk_window()));
 118 
 119     if (parent_window != NULL) {
 120         parent_ctx = (WindowContextPlug *)g_object_get_data(G_OBJECT(parent_window), GDK_WINDOW_DATA_CONTEXT);
 121         // HACK: do not use get_gtk_window()
 122         // the method is intended to return GtkWindow that can be used for FileChooser
 123         // (OK, that's also a hack, but still...)
 124         if (parent_ctx != NULL) {
 125             parent_widget = GTK_WIDGET(parent_ctx->get_gtk_window());
 126         }
 127     }
 128 
 129     if (parent_widget == NULL) {
 130         // If 'owner' is a bad handle, then the child window is created unparented
 131         ctx = new WindowContextPlug(obj, JLONG_TO_PTR(owner));
 132     } else {
 133         ctx = new WindowContextChild(obj,
 134                         JLONG_TO_PTR(owner),
 135                         parent_ctx->gtk_container,
 136                         parent_ctx);
 137     }


< prev index next >