diff options
| author | Yuuki Harano | 2019-07-03 01:05:10 +0900 |
|---|---|---|
| committer | Jeff Walsh | 2020-11-22 14:46:55 +1100 |
| commit | 1d549fa0690d174446ff139bece6db5decd25eba (patch) | |
| tree | 057c8e84b0d559f2c287dd42961dfe07f7dd5944 /src/pgtkterm.c | |
| parent | 592badc3571cc3bb315db8f08ee38db4f6a8cb82 (diff) | |
| download | emacs-1d549fa0690d174446ff139bece6db5decd25eba.tar.gz emacs-1d549fa0690d174446ff139bece6db5decd25eba.zip | |
Add support for make-frame-(in)visible
* ../src/pgtkterm.c (pgtk_make_frame_visible_wait_for_map_event_cb)
(pgtk_make_frame_visible_wait_for_map_event_timeout)
(x_make_frame_visible, x_new_font)
(pgtk_make_frame_visible_invisible, pgtk_make_frame_visible)
(pgtk_redisplay_interface, pgtk_create_terminal, map_event)
(syms_of_pgtkterm):
make-frame-visible/invisible 実装。
Diffstat (limited to 'src/pgtkterm.c')
| -rw-r--r-- | src/pgtkterm.c | 105 |
1 files changed, 44 insertions, 61 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index e081d8c23e1..3e3c73ce503 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -462,14 +462,25 @@ pgtk_iconify_frame (struct frame *f) | |||
| 462 | SET_FRAME_ICONIFIED (f, true); | 462 | SET_FRAME_ICONIFIED (f, true); |
| 463 | SET_FRAME_VISIBLE (f, 0); | 463 | SET_FRAME_VISIBLE (f, 0); |
| 464 | 464 | ||
| 465 | #if 0 | ||
| 466 | XFlush (FRAME_X_DISPLAY (f)); | ||
| 467 | #else | ||
| 468 | gdk_flush(); | ||
| 469 | #endif | ||
| 470 | unblock_input (); | 465 | unblock_input (); |
| 471 | } | 466 | } |
| 472 | 467 | ||
| 468 | static gboolean | ||
| 469 | pgtk_make_frame_visible_wait_for_map_event_cb (GtkWidget *widget, GdkEventAny *event, gpointer user_data) | ||
| 470 | { | ||
| 471 | int *foundptr = user_data; | ||
| 472 | *foundptr = 1; | ||
| 473 | return FALSE; | ||
| 474 | } | ||
| 475 | |||
| 476 | static gboolean | ||
| 477 | pgtk_make_frame_visible_wait_for_map_event_timeout (gpointer user_data) | ||
| 478 | { | ||
| 479 | int *timedoutptr = user_data; | ||
| 480 | *timedoutptr = 1; | ||
| 481 | return FALSE; | ||
| 482 | } | ||
| 483 | |||
| 473 | void | 484 | void |
| 474 | pgtk_make_frame_visible (struct frame *f) | 485 | pgtk_make_frame_visible (struct frame *f) |
| 475 | /* -------------------------------------------------------------------------- | 486 | /* -------------------------------------------------------------------------- |
| @@ -478,54 +489,26 @@ pgtk_make_frame_visible (struct frame *f) | |||
| 478 | { | 489 | { |
| 479 | PGTK_TRACE("pgtk_make_frame_visible"); | 490 | PGTK_TRACE("pgtk_make_frame_visible"); |
| 480 | 491 | ||
| 481 | GtkWidget *win = FRAME_OUTPUT_DATA(f)->widget; | 492 | GtkWidget *win = FRAME_GTK_OUTER_WIDGET (f); |
| 482 | 493 | ||
| 483 | gtk_widget_show(win); | 494 | if (! FRAME_VISIBLE_P (f)) |
| 484 | |||
| 485 | #if 0 | ||
| 486 | NSTRACE ("x_make_frame_visible"); | ||
| 487 | /* XXX: at some points in past this was not needed, as the only place that | ||
| 488 | called this (frame.c:Fraise_frame ()) also called raise_lower; | ||
| 489 | if this ends up the case again, comment this out again. */ | ||
| 490 | if (!FRAME_VISIBLE_P (f)) | ||
| 491 | { | 495 | { |
| 492 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | 496 | gtk_widget_show(win); |
| 493 | NSWindow *window = [view window]; | 497 | gtk_window_deiconify(GTK_WINDOW(win)); |
| 494 | |||
| 495 | SET_FRAME_VISIBLE (f, 1); | ||
| 496 | ns_raise_frame (f, ! FRAME_NO_FOCUS_ON_MAP (f)); | ||
| 497 | 498 | ||
| 498 | /* Making a new frame from a fullscreen frame will make the new frame | 499 | if (FLOATP (Vpgtk_wait_for_event_timeout)) { |
| 499 | fullscreen also. So skip handleFS as this will print an error. */ | 500 | guint msec = (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000); |
| 500 | if ([view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH | 501 | int found = 0; |
| 501 | && [view isFullscreen]) | 502 | int timed_out = 0; |
| 502 | return; | 503 | gulong id = g_signal_connect(win, "map-event", G_CALLBACK(pgtk_make_frame_visible_wait_for_map_event_cb), &found); |
| 503 | 504 | guint src = g_timeout_add(msec, pgtk_make_frame_visible_wait_for_map_event_timeout, &timed_out); | |
| 504 | if (f->want_fullscreen != FULLSCREEN_NONE) | 505 | while (!found && !timed_out) |
| 505 | { | 506 | gtk_main_iteration(); |
| 506 | block_input (); | 507 | g_signal_handler_disconnect (win, id); |
| 507 | [view handleFS]; | 508 | if (!timed_out) |
| 508 | unblock_input (); | 509 | g_source_remove(src); |
| 509 | } | 510 | } |
| 510 | |||
| 511 | /* Making a frame invisible seems to break the parent->child | ||
| 512 | relationship, so reinstate it. */ | ||
| 513 | if ([window parentWindow] == nil && FRAME_PARENT_FRAME (f) != NULL) | ||
| 514 | { | ||
| 515 | NSWindow *parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window]; | ||
| 516 | |||
| 517 | block_input (); | ||
| 518 | [parent addChildWindow: window | ||
| 519 | ordered: NSWindowAbove]; | ||
| 520 | unblock_input (); | ||
| 521 | |||
| 522 | /* If the parent frame moved while the child frame was | ||
| 523 | invisible, the child frame's position won't have been | ||
| 524 | updated. Make sure it's in the right place now. */ | ||
| 525 | x_set_offset(f, f->left_pos, f->top_pos, 0); | ||
| 526 | } | ||
| 527 | } | 511 | } |
| 528 | #endif | ||
| 529 | } | 512 | } |
| 530 | 513 | ||
| 531 | 514 | ||
| @@ -541,15 +524,17 @@ pgtk_make_frame_invisible (struct frame *f) | |||
| 541 | 524 | ||
| 542 | gtk_widget_hide(win); | 525 | gtk_widget_hide(win); |
| 543 | 526 | ||
| 544 | #if 0 | ||
| 545 | NSView *view; | ||
| 546 | NSTRACE ("x_make_frame_invisible"); | ||
| 547 | check_window_system (f); | ||
| 548 | view = FRAME_NS_VIEW (f); | ||
| 549 | [[view window] orderOut: NSApp]; | ||
| 550 | SET_FRAME_VISIBLE (f, 0); | 527 | SET_FRAME_VISIBLE (f, 0); |
| 551 | SET_FRAME_ICONIFIED (f, 0); | 528 | SET_FRAME_ICONIFIED (f, false); |
| 552 | #endif | 529 | } |
| 530 | |||
| 531 | static void | ||
| 532 | pgtk_make_frame_visible_invisible (struct frame *f, bool visible) | ||
| 533 | { | ||
| 534 | if (visible) | ||
| 535 | pgtk_make_frame_visible (f); | ||
| 536 | else | ||
| 537 | pgtk_make_frame_invisible (f); | ||
| 553 | } | 538 | } |
| 554 | 539 | ||
| 555 | static Lisp_Object | 540 | static Lisp_Object |
| @@ -3296,9 +3281,6 @@ pgtk_hide_hourglass(struct frame *f) | |||
| 3296 | static void | 3281 | static void |
| 3297 | pgtk_flush_display (struct frame *f) | 3282 | pgtk_flush_display (struct frame *f) |
| 3298 | { | 3283 | { |
| 3299 | block_input (); | ||
| 3300 | gdk_flush(); | ||
| 3301 | unblock_input (); | ||
| 3302 | } | 3284 | } |
| 3303 | 3285 | ||
| 3304 | extern frame_parm_handler pgtk_frame_parm_handlers[]; | 3286 | extern frame_parm_handler pgtk_frame_parm_handlers[]; |
| @@ -4348,6 +4330,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo) | |||
| 4348 | terminal->mouse_position_hook = pgtk_mouse_position; | 4330 | terminal->mouse_position_hook = pgtk_mouse_position; |
| 4349 | // terminal->frame_rehighlight_hook = pgtk_frame_rehighlight; | 4331 | // terminal->frame_rehighlight_hook = pgtk_frame_rehighlight; |
| 4350 | // terminal->frame_raise_lower_hook = pgtk_frame_raise_lower; | 4332 | // terminal->frame_raise_lower_hook = pgtk_frame_raise_lower; |
| 4333 | terminal->frame_visible_invisible_hook = pgtk_make_frame_visible_invisible; | ||
| 4351 | terminal->fullscreen_hook = pgtk_fullscreen_hook; | 4334 | terminal->fullscreen_hook = pgtk_fullscreen_hook; |
| 4352 | terminal->menu_show_hook = pgtk_menu_show; | 4335 | terminal->menu_show_hook = pgtk_menu_show; |
| 4353 | terminal->activate_menubar_hook = pgtk_activate_menubar; | 4336 | terminal->activate_menubar_hook = pgtk_activate_menubar; |
| @@ -5014,7 +4997,7 @@ static gboolean map_event(GtkWidget *widget, GdkEvent *event, gpointer *user_dat | |||
| 5014 | 4997 | ||
| 5015 | if (inev.ie.kind != NO_EVENT) | 4998 | if (inev.ie.kind != NO_EVENT) |
| 5016 | evq_enqueue(&inev); | 4999 | evq_enqueue(&inev); |
| 5017 | return TRUE; | 5000 | return FALSE; |
| 5018 | } | 5001 | } |
| 5019 | 5002 | ||
| 5020 | static gboolean window_state_event(GtkWidget *widget, GdkEvent *event, gpointer *user_data) | 5003 | static gboolean window_state_event(GtkWidget *widget, GdkEvent *event, gpointer *user_data) |