1 /* 2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 #include <com_sun_glass_ui_gtk_GtkWindow.h> 26 #include <com_sun_glass_events_WindowEvent.h> 27 #include <com_sun_glass_events_ViewEvent.h> 28 29 #include <cstdlib> 30 #include <cstring> 31 #include "glass_general.h" 32 #include "glass_evloop.h" 33 #include "glass_window.h" 34 35 #define JLONG_TO_WINDOW_CTX(ptr) ((WindowContext*)JLONG_TO_PTR(ptr)) 36 37 static WindowFrameType glass_mask_to_window_frame_type(jint mask) { 38 if (mask & com_sun_glass_ui_gtk_GtkWindow_TRANSPARENT) { 39 return TRANSPARENT; 40 } 41 if (mask & com_sun_glass_ui_gtk_GtkWindow_TITLED) { 42 return TITLED; 43 } 44 return UNTITLED; 45 } 46 47 static WindowType glass_mask_to_window_type(jint mask) { 48 if (mask & com_sun_glass_ui_gtk_GtkWindow_POPUP) { 49 return POPUP; 50 } 51 if (mask & com_sun_glass_ui_gtk_GtkWindow_UTILITY) { 52 return UTILITY; 53 } 54 return NORMAL; 55 } 56 57 static GdkWMFunction glass_mask_to_wm_function(jint mask) { 58 int func = GDK_FUNC_RESIZE | GDK_FUNC_MOVE; 59 60 if (mask & com_sun_glass_ui_gtk_GtkWindow_CLOSABLE) { 61 func |= GDK_FUNC_CLOSE; 62 } 63 if (mask & com_sun_glass_ui_gtk_GtkWindow_MAXIMIZABLE) { 64 func |= GDK_FUNC_MAXIMIZE; 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 } 134 135 return PTR_TO_JLONG(ctx); 136 } 137 138 /* 139 * Class: com_sun_glass_ui_gtk_GtkWindow 140 * Method: _close 141 * Signature: (J)Z 142 */ 143 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1close 144 (JNIEnv * env, jobject obj, jlong ptr) 145 { 146 (void)env; 147 (void)obj; 148 149 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 150 destroy_and_delete_ctx(ctx); 151 return JNI_TRUE; // return value not used 152 } 153 /* 154 * Class: com_sun_glass_ui_gtk_GtkWindow 155 * Method: _setView 156 * Signature: (JLcom/sun/glass/ui/View;)Z 157 */ 158 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setView 159 (JNIEnv * env, jobject obj, jlong ptr, jobject view) 160 { 161 (void)env; 162 (void)obj; 163 164 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 165 return (ctx->set_view(view)) ? JNI_TRUE : JNI_FALSE; 166 } 167 /* 168 * Class: com_sun_glass_ui_gtk_GtkWindow 169 * Method: _showOrHideChildren 170 * Signature: (JZ)V 171 */ 172 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1showOrHideChildren 173 (JNIEnv *env, jobject obj, jlong ptr, jboolean show) 174 { 175 (void)env; 176 (void)obj; 177 178 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 179 ctx->show_or_hide_children(show); 180 } 181 182 /* 183 * Class: com_sun_glass_ui_gtk_GtkWindow 184 * Method: minimizeImpl 185 * Signature: (JZ)V 186 */ 187 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_minimizeImpl 188 (JNIEnv * env, jobject obj, jlong ptr, jboolean minimize) 189 { 190 (void)env; 191 (void)obj; 192 193 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 194 ctx->set_minimized(minimize); 195 } 196 197 /* 198 * Class: com_sun_glass_ui_gtk_GtkWindow 199 * Method: maximizeImpl 200 * Signature: (JZZ)V 201 */ 202 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_maximizeImpl 203 (JNIEnv * env, jobject obj, jlong ptr, jboolean maximize, jboolean wasMaximized) 204 { 205 (void)env; 206 (void)obj; 207 (void)wasMaximized; 208 209 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 210 ctx->set_maximized(maximize); 211 } 212 213 /* 214 * Class: com_sun_glass_ui_gtk_GtkWindow 215 * Method: setBoundsImpl 216 * Signature: (JIIZZIIII)V 217 */ 218 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_setBoundsImpl 219 (JNIEnv * env, jobject obj, jlong ptr, jint x, jint y, jboolean xSet, jboolean ySet, jint w, jint h, jint cw, jint ch) 220 { 221 (void)env; 222 (void)obj; 223 224 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 225 ctx->set_bounds(x, y, xSet, ySet, w, h, cw, ch); 226 } 227 228 /* 229 * Class: com_sun_glass_ui_gtk_GtkWindow 230 * Method: setVisibleImpl 231 * Signature: (JZ)V 232 */ 233 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_setVisibleImpl 234 (JNIEnv * env, jobject obj, jlong ptr, jboolean visible) 235 { 236 (void)env; 237 (void)obj; 238 239 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 240 ctx->set_visible(visible); 241 } 242 243 /* 244 * Class: com_sun_glass_ui_gtk_GtkWindow 245 * Method: _setResizable 246 * Signature: (JZ)Z 247 */ 248 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setResizable 249 (JNIEnv * env, jobject obj, jlong ptr, jboolean resizable) 250 { 251 (void)env; 252 (void)obj; 253 254 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 255 ctx->set_resizable(resizable); 256 return JNI_TRUE; 257 } 258 259 /* 260 * Class: com_sun_glass_ui_gtk_GtkWindow 261 * Method: _requestFocus 262 * Signature: (JI)Z 263 */ 264 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1requestFocus 265 (JNIEnv * env, jobject obj, jlong ptr, jint focus) 266 { 267 (void)env; 268 (void)obj; 269 (void)focus; 270 271 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 272 ctx->request_focus(); 273 return JNI_TRUE; //not used 274 } 275 276 /* 277 * Class: com_sun_glass_ui_gtk_GtkWindow 278 * Method: _setFocusable 279 * Signature: (JZ)V 280 */ 281 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setFocusable 282 (JNIEnv * env, jobject obj, jlong ptr, jboolean focusable) 283 { 284 (void)env; 285 (void)obj; 286 287 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 288 ctx->set_focusable(focusable); 289 } 290 291 /* 292 * Class: com_sun_glass_ui_gtk_GtkWindow 293 * Method: _grabFocus 294 * Signature: (J)Z 295 */ 296 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1grabFocus 297 (JNIEnv * env, jobject obj, jlong ptr) 298 { 299 (void)env; 300 (void)obj; 301 302 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 303 return ctx->grab_focus(); 304 } 305 306 /* 307 * Class: com_sun_glass_ui_gtk_GtkWindow 308 * Method: _ungrabFocus 309 * Signature: (J)V 310 */ 311 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1ungrabFocus 312 (JNIEnv * env, jobject obj, jlong ptr) 313 { 314 (void)env; 315 (void)obj; 316 317 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 318 ctx->ungrab_focus(); 319 } 320 321 /* 322 * Class: com_sun_glass_ui_gtk_GtkWindow 323 * Method: _setTitle 324 * Signature: (JLjava/lang/String;)Z 325 */ 326 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setTitle 327 (JNIEnv * env, jobject obj, jlong ptr, jstring title) 328 { 329 (void)env; 330 (void)obj; 331 332 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 333 const char* ctitle = mainEnv->GetStringUTFChars(title, NULL); 334 ctx->set_title(ctitle); 335 mainEnv->ReleaseStringUTFChars(title, ctitle); 336 337 return JNI_TRUE; 338 } 339 340 /* 341 * Class: com_sun_glass_ui_gtk_GtkWindow 342 * Method: _setLevel 343 * Signature: (JI)V 344 */ 345 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setLevel 346 (JNIEnv * env, jobject obj, jlong ptr, jint level) 347 { 348 (void)env; 349 (void)obj; 350 351 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 352 ctx->set_level(level); 353 } 354 355 /* 356 * Class: com_sun_glass_ui_gtk_GtkWindow 357 * Method: _setAlpha 358 * Signature: (JF)V 359 */ 360 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setAlpha 361 (JNIEnv * env, jobject obj, jlong ptr, jfloat alpha) 362 { 363 (void)env; 364 (void)obj; 365 366 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 367 ctx->set_alpha(alpha); 368 } 369 370 /* 371 * Class: com_sun_glass_ui_gtk_GtkWindow 372 * Method: _setBackground 373 * Signature: (JFFF)Z 374 */ 375 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setBackground 376 (JNIEnv * env, jobject obj, jlong ptr, jfloat r, jfloat g, jfloat b) 377 { 378 (void)env; 379 (void)obj; 380 381 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 382 ctx->set_background(r, g, b); 383 return JNI_TRUE; 384 } 385 386 /* 387 * Class: com_sun_glass_ui_gtk_GtkWindow 388 * Method: _setEnabled 389 * Signature: (JZ)V 390 */ 391 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setEnabled 392 (JNIEnv * env, jobject obj, jlong ptr, jboolean enabled) 393 { 394 (void)env; 395 (void)obj; 396 397 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 398 ctx->set_enabled(enabled); 399 } 400 401 /* 402 * Class: com_sun_glass_ui_gtk_GtkWindow 403 * Method: _setMinimumSize 404 * Signature: (JII)Z 405 */ 406 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setMinimumSize 407 (JNIEnv * env, jobject obj, jlong ptr, jint w, jint h) 408 { 409 (void)env; 410 (void)obj; 411 412 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 413 if (w < 0 || h < 0) return JNI_FALSE; 414 ctx->set_minimum_size(w, h); 415 return JNI_TRUE; 416 } 417 418 /* 419 * Class: com_sun_glass_ui_gtk_GtkWindow 420 * Method: _setMaximumSize 421 * Signature: (JII)Z 422 */ 423 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setMaximumSize 424 (JNIEnv * env, jobject obj, jlong ptr, jint w, jint h) 425 { 426 (void)env; 427 (void)obj; 428 429 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 430 if (w == 0 || h == 0) return JNI_FALSE; 431 if (w == -1) w = G_MAXSHORT; 432 if (h == -1) h = G_MAXSHORT; 433 434 ctx->set_maximum_size(w, h); 435 return JNI_TRUE; 436 } 437 438 /* 439 * Class: com_sun_glass_ui_gtk_GtkWindow 440 * Method: _setIcon 441 * Signature: (JLcom/sun/glass/ui/Pixels;)V 442 */ 443 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setIcon 444 (JNIEnv * env, jobject obj, jlong ptr, jobject pixels) 445 { 446 (void)obj; 447 448 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 449 GdkPixbuf *pixbuf = NULL; 450 if (pixels != NULL) { 451 env->CallVoidMethod(pixels, jPixelsAttachData, PTR_TO_JLONG(&pixbuf)); 452 } 453 if (!EXCEPTION_OCCURED(env)) { 454 ctx->set_icon(pixbuf); 455 } 456 if (pixbuf != NULL) g_object_unref(pixbuf); 457 } 458 459 /* 460 * Class: com_sun_glass_ui_gtk_GtkWindow 461 * Method: _toFront 462 * Signature: (J)V 463 */ 464 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1toFront 465 (JNIEnv * env, jobject obj, jlong ptr) 466 { 467 (void)env; 468 (void)obj; 469 470 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 471 ctx->restack(true); 472 } 473 474 /* 475 * Class: com_sun_glass_ui_gtk_GtkWindow 476 * Method: _toBack 477 * Signature: (J)V 478 */ 479 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1toBack 480 (JNIEnv * env, jobject obj, jlong ptr) 481 { 482 (void)env; 483 (void)obj; 484 485 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 486 ctx->restack(false); 487 488 } 489 490 /* 491 * Class: com_sun_glass_ui_gtk_GtkWindow 492 * Method: _enterModal 493 * Signature: (J)V 494 */ 495 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1enterModal 496 (JNIEnv * env, jobject obj, jlong ptr) 497 { 498 (void)env; 499 (void)obj; 500 501 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 502 ctx->set_modal(true); 503 } 504 505 /* 506 * Class: com_sun_glass_ui_gtk_GtkWindow 507 * Method: _enterModalWithWindow 508 * Signature: (JJ)V 509 */ 510 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1enterModalWithWindow 511 (JNIEnv * env, jobject obj, jlong ptrDialog, jlong ptrWindow) 512 { 513 (void)env; 514 (void)obj; 515 516 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptrDialog); 517 WindowContext* parent_ctx = JLONG_TO_WINDOW_CTX(ptrWindow); 518 ctx->set_modal(true, parent_ctx); 519 } 520 521 /* 522 * Class: com_sun_glass_ui_gtk_GtkWindow 523 * Method: _exitModal 524 * Signature: (J)V 525 */ 526 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1exitModal 527 (JNIEnv * env, jobject obj, jlong ptr) 528 { 529 (void)env; 530 (void)obj; 531 532 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 533 ctx->set_modal(false); 534 } 535 536 /* 537 * Class: com_sun_glass_ui_gtk_GtkCursor 538 * Method: _setCursorType 539 * Signature: (JI)V 540 */ 541 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setCursorType 542 (JNIEnv * env, jobject obj, jlong ptr, jint type) 543 { 544 (void)env; 545 (void)obj; 546 547 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 548 GdkCursor *cursor = get_native_cursor(type); 549 ctx->set_cursor(cursor); 550 } 551 552 /* 553 * Class: com_sun_glass_ui_gtk_GtkCursor 554 * Method: _setCustomCursor 555 * Signature: (JLcom/sun/glass/ui/Cursor;)V 556 */ 557 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setCustomCursor 558 (JNIEnv * env, jobject obj, jlong ptr, jobject jCursor) 559 { 560 (void)obj; 561 562 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 563 GdkCursor *cursor = (GdkCursor*)JLONG_TO_PTR(env->GetLongField(jCursor, jCursorPtr)); 564 565 ctx->set_cursor(cursor); 566 } 567 568 /* 569 * Class: com_sun_glass_ui_gtk_GtkWindow 570 * Method: isVisible 571 * Signature: (J)Z 572 */ 573 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_isVisible 574 (JNIEnv * env, jobject obj, jlong ptr) 575 { 576 (void)env; 577 (void)obj; 578 579 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 580 return ctx->is_visible() ? JNI_TRUE : JNI_FALSE; 581 } 582 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getNativeWindowImpl 583 (JNIEnv * env, jobject obj, jlong ptr) 584 { 585 (void)env; 586 (void)obj; 587 588 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 589 return GDK_WINDOW_XID(ctx->get_gdk_window()); 590 } 591 /* 592 * Class: com_sun_glass_ui_gtk_GtkWindow 593 * Method: getFrameExtents 594 * Signature: (J[I)V 595 */ 596 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_getFrameExtents 597 (JNIEnv * env, jobject obj, jlong ptr, jintArray extarr) 598 { 599 (void)obj; 600 601 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 602 WindowFrameExtents extents = ctx->get_frame_extents(); 603 604 env->SetIntArrayRegion(extarr, 0, 1, &extents.left); 605 env->SetIntArrayRegion(extarr, 1, 1, &extents.right); 606 env->SetIntArrayRegion(extarr, 2, 1, &extents.top); 607 env->SetIntArrayRegion(extarr, 3, 1, &extents.bottom); 608 } 609 610 /* 611 * Class: com_sun_glass_ui_gtk_GtkWindow 612 * Method: _setGravity 613 * Signature: (JFF)V 614 */ 615 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setGravity 616 (JNIEnv * env, jobject obj, jlong ptr, jfloat xGravity, jfloat yGravity) 617 { 618 (void)env; 619 (void)obj; 620 621 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 622 ctx->set_gravity(xGravity, yGravity); 623 624 } 625 626 627 /* 628 * Class: com_sun_glass_ui_gtk_GtkWindow 629 * Method: _getEmbeddedX 630 * Signature: (J)I 631 */ 632 JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getEmbeddedX 633 (JNIEnv *env, jobject obj, jlong ptr) { 634 (void)env; 635 (void)obj; 636 637 if (ptr) { 638 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 639 return (jint) ctx->getEmbeddedX(); 640 } 641 return 0; 642 } 643 644 /* 645 * Class: com_sun_glass_ui_gtk_GtkWindow 646 * Method: _getEmbeddedY 647 * Signature: (J)I 648 */ 649 JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getEmbeddedY 650 (JNIEnv *env, jobject obj, jlong ptr) { 651 (void)env; 652 (void)obj; 653 654 if (ptr) { 655 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 656 return (jint) ctx->getEmbeddedY(); 657 } 658 return 0; 659 } 660 661 } // extern "C"