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* 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 } 138 139 return PTR_TO_JLONG(ctx); 140 } 141 142 /* 143 * Class: com_sun_glass_ui_gtk_GtkWindow 144 * Method: _close 145 * Signature: (J)Z 146 */ 147 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1close 148 (JNIEnv * env, jobject obj, jlong ptr) 149 { 150 (void)env; 151 (void)obj; 152 153 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 154 destroy_and_delete_ctx(ctx); 155 return JNI_TRUE; // return value not used 156 } 157 /* 158 * Class: com_sun_glass_ui_gtk_GtkWindow 159 * Method: _setView 160 * Signature: (JLcom/sun/glass/ui/View;)Z 161 */ 162 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setView 163 (JNIEnv * env, jobject obj, jlong ptr, jobject view) 164 { 165 (void)env; 166 (void)obj; 167 168 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 169 return (ctx->set_view(view)) ? JNI_TRUE : JNI_FALSE; 170 } 171 /* 172 * Class: com_sun_glass_ui_gtk_GtkWindow 173 * Method: _showOrHideChildren 174 * Signature: (JZ)V 175 */ 176 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1showOrHideChildren 177 (JNIEnv *env, jobject obj, jlong ptr, jboolean show) 178 { 179 (void)env; 180 (void)obj; 181 182 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 183 ctx->show_or_hide_children(show); 184 } 185 186 /* 187 * Class: com_sun_glass_ui_gtk_GtkWindow 188 * Method: minimizeImpl 189 * Signature: (JZ)V 190 */ 191 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_minimizeImpl 192 (JNIEnv * env, jobject obj, jlong ptr, jboolean minimize) 193 { 194 (void)env; 195 (void)obj; 196 197 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 198 ctx->set_minimized(minimize); 199 } 200 201 /* 202 * Class: com_sun_glass_ui_gtk_GtkWindow 203 * Method: maximizeImpl 204 * Signature: (JZZ)V 205 */ 206 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_maximizeImpl 207 (JNIEnv * env, jobject obj, jlong ptr, jboolean maximize, jboolean wasMaximized) 208 { 209 (void)env; 210 (void)obj; 211 (void)wasMaximized; 212 213 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 214 ctx->set_maximized(maximize); 215 } 216 217 /* 218 * Class: com_sun_glass_ui_gtk_GtkWindow 219 * Method: setBoundsImpl 220 * Signature: (JIIZZIIII)V 221 */ 222 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_setBoundsImpl 223 (JNIEnv * env, jobject obj, jlong ptr, jint x, jint y, jboolean xSet, jboolean ySet, jint w, jint h, jint cw, jint ch) 224 { 225 (void)env; 226 (void)obj; 227 228 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 229 ctx->set_bounds(x, y, xSet, ySet, w, h, cw, ch); 230 } 231 232 /* 233 * Class: com_sun_glass_ui_gtk_GtkWindow 234 * Method: setVisibleImpl 235 * Signature: (JZ)V 236 */ 237 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_setVisibleImpl 238 (JNIEnv * env, jobject obj, jlong ptr, jboolean visible) 239 { 240 (void)env; 241 (void)obj; 242 243 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 244 ctx->set_visible(visible); 245 } 246 247 /* 248 * Class: com_sun_glass_ui_gtk_GtkWindow 249 * Method: _setResizable 250 * Signature: (JZ)Z 251 */ 252 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setResizable 253 (JNIEnv * env, jobject obj, jlong ptr, jboolean resizable) 254 { 255 (void)env; 256 (void)obj; 257 258 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 259 ctx->set_resizable(resizable); 260 return JNI_TRUE; 261 } 262 263 /* 264 * Class: com_sun_glass_ui_gtk_GtkWindow 265 * Method: _requestFocus 266 * Signature: (JI)Z 267 */ 268 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1requestFocus 269 (JNIEnv * env, jobject obj, jlong ptr, jint focus) 270 { 271 (void)env; 272 (void)obj; 273 (void)focus; 274 275 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 276 ctx->request_focus(); 277 return JNI_TRUE; //not used 278 } 279 280 /* 281 * Class: com_sun_glass_ui_gtk_GtkWindow 282 * Method: _setFocusable 283 * Signature: (JZ)V 284 */ 285 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setFocusable 286 (JNIEnv * env, jobject obj, jlong ptr, jboolean focusable) 287 { 288 (void)env; 289 (void)obj; 290 291 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 292 ctx->set_focusable(focusable); 293 } 294 295 /* 296 * Class: com_sun_glass_ui_gtk_GtkWindow 297 * Method: _grabFocus 298 * Signature: (J)Z 299 */ 300 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1grabFocus 301 (JNIEnv * env, jobject obj, jlong ptr) 302 { 303 (void)env; 304 (void)obj; 305 306 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 307 return ctx->grab_focus(); 308 } 309 310 /* 311 * Class: com_sun_glass_ui_gtk_GtkWindow 312 * Method: _ungrabFocus 313 * Signature: (J)V 314 */ 315 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1ungrabFocus 316 (JNIEnv * env, jobject obj, jlong ptr) 317 { 318 (void)env; 319 (void)obj; 320 321 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 322 ctx->ungrab_focus(); 323 } 324 325 /* 326 * Class: com_sun_glass_ui_gtk_GtkWindow 327 * Method: _setTitle 328 * Signature: (JLjava/lang/String;)Z 329 */ 330 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setTitle 331 (JNIEnv * env, jobject obj, jlong ptr, jstring title) 332 { 333 (void)env; 334 (void)obj; 335 336 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 337 const char* ctitle = mainEnv->GetStringUTFChars(title, NULL); 338 ctx->set_title(ctitle); 339 mainEnv->ReleaseStringUTFChars(title, ctitle); 340 341 return JNI_TRUE; 342 } 343 344 /* 345 * Class: com_sun_glass_ui_gtk_GtkWindow 346 * Method: _setLevel 347 * Signature: (JI)V 348 */ 349 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setLevel 350 (JNIEnv * env, jobject obj, jlong ptr, jint level) 351 { 352 (void)env; 353 (void)obj; 354 355 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 356 ctx->set_level(level); 357 } 358 359 /* 360 * Class: com_sun_glass_ui_gtk_GtkWindow 361 * Method: _setAlpha 362 * Signature: (JF)V 363 */ 364 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setAlpha 365 (JNIEnv * env, jobject obj, jlong ptr, jfloat alpha) 366 { 367 (void)env; 368 (void)obj; 369 370 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 371 ctx->set_alpha(alpha); 372 } 373 374 /* 375 * Class: com_sun_glass_ui_gtk_GtkWindow 376 * Method: _setBackground 377 * Signature: (JFFF)Z 378 */ 379 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setBackground 380 (JNIEnv * env, jobject obj, jlong ptr, jfloat r, jfloat g, jfloat b) 381 { 382 (void)env; 383 (void)obj; 384 385 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 386 ctx->set_background(r, g, b); 387 return JNI_TRUE; 388 } 389 390 /* 391 * Class: com_sun_glass_ui_gtk_GtkWindow 392 * Method: _setEnabled 393 * Signature: (JZ)V 394 */ 395 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setEnabled 396 (JNIEnv * env, jobject obj, jlong ptr, jboolean enabled) 397 { 398 (void)env; 399 (void)obj; 400 401 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 402 ctx->set_enabled(enabled); 403 } 404 405 /* 406 * Class: com_sun_glass_ui_gtk_GtkWindow 407 * Method: _setMinimumSize 408 * Signature: (JII)Z 409 */ 410 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setMinimumSize 411 (JNIEnv * env, jobject obj, jlong ptr, jint w, jint h) 412 { 413 (void)env; 414 (void)obj; 415 416 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 417 if (w < 0 || h < 0) return JNI_FALSE; 418 ctx->set_minimum_size(w, h); 419 return JNI_TRUE; 420 } 421 422 /* 423 * Class: com_sun_glass_ui_gtk_GtkWindow 424 * Method: _setMaximumSize 425 * Signature: (JII)Z 426 */ 427 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setMaximumSize 428 (JNIEnv * env, jobject obj, jlong ptr, jint w, jint h) 429 { 430 (void)env; 431 (void)obj; 432 433 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 434 if (w == 0 || h == 0) return JNI_FALSE; 435 if (w == -1) w = G_MAXSHORT; 436 if (h == -1) h = G_MAXSHORT; 437 438 ctx->set_maximum_size(w, h); 439 return JNI_TRUE; 440 } 441 442 /* 443 * Class: com_sun_glass_ui_gtk_GtkWindow 444 * Method: _setIcon 445 * Signature: (JLcom/sun/glass/ui/Pixels;)V 446 */ 447 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setIcon 448 (JNIEnv * env, jobject obj, jlong ptr, jobject pixels) 449 { 450 (void)obj; 451 452 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 453 GdkPixbuf *pixbuf = NULL; 454 if (pixels != NULL) { 455 env->CallVoidMethod(pixels, jPixelsAttachData, PTR_TO_JLONG(&pixbuf)); 456 } 457 if (!EXCEPTION_OCCURED(env)) { 458 ctx->set_icon(pixbuf); 459 } 460 if (pixbuf != NULL) g_object_unref(pixbuf); 461 } 462 463 /* 464 * Class: com_sun_glass_ui_gtk_GtkWindow 465 * Method: _toFront 466 * Signature: (J)V 467 */ 468 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1toFront 469 (JNIEnv * env, jobject obj, jlong ptr) 470 { 471 (void)env; 472 (void)obj; 473 474 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 475 ctx->restack(true); 476 } 477 478 /* 479 * Class: com_sun_glass_ui_gtk_GtkWindow 480 * Method: _toBack 481 * Signature: (J)V 482 */ 483 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1toBack 484 (JNIEnv * env, jobject obj, jlong ptr) 485 { 486 (void)env; 487 (void)obj; 488 489 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 490 ctx->restack(false); 491 492 } 493 494 /* 495 * Class: com_sun_glass_ui_gtk_GtkWindow 496 * Method: _enterModal 497 * Signature: (J)V 498 */ 499 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1enterModal 500 (JNIEnv * env, jobject obj, jlong ptr) 501 { 502 (void)env; 503 (void)obj; 504 505 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 506 ctx->set_modal(true); 507 } 508 509 /* 510 * Class: com_sun_glass_ui_gtk_GtkWindow 511 * Method: _enterModalWithWindow 512 * Signature: (JJ)V 513 */ 514 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1enterModalWithWindow 515 (JNIEnv * env, jobject obj, jlong ptrDialog, jlong ptrWindow) 516 { 517 (void)env; 518 (void)obj; 519 520 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptrDialog); 521 WindowContext* parent_ctx = JLONG_TO_WINDOW_CTX(ptrWindow); 522 ctx->set_modal(true, parent_ctx); 523 } 524 525 /* 526 * Class: com_sun_glass_ui_gtk_GtkWindow 527 * Method: _exitModal 528 * Signature: (J)V 529 */ 530 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1exitModal 531 (JNIEnv * env, jobject obj, jlong ptr) 532 { 533 (void)env; 534 (void)obj; 535 536 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 537 ctx->set_modal(false); 538 } 539 540 /* 541 * Class: com_sun_glass_ui_gtk_GtkCursor 542 * Method: _setCursorType 543 * Signature: (JI)V 544 */ 545 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setCursorType 546 (JNIEnv * env, jobject obj, jlong ptr, jint type) 547 { 548 (void)env; 549 (void)obj; 550 551 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 552 GdkCursor *cursor = get_native_cursor(type); 553 ctx->set_cursor(cursor); 554 } 555 556 /* 557 * Class: com_sun_glass_ui_gtk_GtkCursor 558 * Method: _setCustomCursor 559 * Signature: (JLcom/sun/glass/ui/Cursor;)V 560 */ 561 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setCustomCursor 562 (JNIEnv * env, jobject obj, jlong ptr, jobject jCursor) 563 { 564 (void)obj; 565 566 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 567 GdkCursor *cursor = (GdkCursor*)JLONG_TO_PTR(env->GetLongField(jCursor, jCursorPtr)); 568 569 ctx->set_cursor(cursor); 570 } 571 572 /* 573 * Class: com_sun_glass_ui_gtk_GtkWindow 574 * Method: isVisible 575 * Signature: (J)Z 576 */ 577 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_isVisible 578 (JNIEnv * env, jobject obj, jlong ptr) 579 { 580 (void)env; 581 (void)obj; 582 583 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 584 return ctx->is_visible() ? JNI_TRUE : JNI_FALSE; 585 } 586 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getNativeWindowImpl 587 (JNIEnv * env, jobject obj, jlong ptr) 588 { 589 (void)env; 590 (void)obj; 591 592 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 593 return GDK_WINDOW_XID(ctx->get_gdk_window()); 594 } 595 /* 596 * Class: com_sun_glass_ui_gtk_GtkWindow 597 * Method: getFrameExtents 598 * Signature: (J[I)V 599 */ 600 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_getFrameExtents 601 (JNIEnv * env, jobject obj, jlong ptr, jintArray extarr) 602 { 603 (void)obj; 604 605 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 606 WindowFrameExtents extents = ctx->get_frame_extents(); 607 608 env->SetIntArrayRegion(extarr, 0, 1, &extents.left); 609 env->SetIntArrayRegion(extarr, 1, 1, &extents.right); 610 env->SetIntArrayRegion(extarr, 2, 1, &extents.top); 611 env->SetIntArrayRegion(extarr, 3, 1, &extents.bottom); 612 } 613 614 /* 615 * Class: com_sun_glass_ui_gtk_GtkWindow 616 * Method: _setGravity 617 * Signature: (JFF)V 618 */ 619 JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setGravity 620 (JNIEnv * env, jobject obj, jlong ptr, jfloat xGravity, jfloat yGravity) 621 { 622 (void)env; 623 (void)obj; 624 625 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 626 ctx->set_gravity(xGravity, yGravity); 627 628 } 629 630 631 /* 632 * Class: com_sun_glass_ui_gtk_GtkWindow 633 * Method: _getEmbeddedX 634 * Signature: (J)I 635 */ 636 JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getEmbeddedX 637 (JNIEnv *env, jobject obj, jlong ptr) { 638 (void)env; 639 (void)obj; 640 641 if (ptr) { 642 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 643 return (jint) ctx->getEmbeddedX(); 644 } 645 return 0; 646 } 647 648 /* 649 * Class: com_sun_glass_ui_gtk_GtkWindow 650 * Method: _getEmbeddedY 651 * Signature: (J)I 652 */ 653 JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getEmbeddedY 654 (JNIEnv *env, jobject obj, jlong ptr) { 655 (void)env; 656 (void)obj; 657 658 if (ptr) { 659 WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr); 660 return (jint) ctx->getEmbeddedY(); 661 } 662 return 0; 663 } 664 665 } // extern "C"