]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement pgtk_frame_raise_lower
authorYuuki Harano <masm+github@masm11.me>
Sat, 11 Dec 2021 13:03:01 +0000 (22:03 +0900)
committerYuuki Harano <masm+github@masm11.me>
Sat, 11 Dec 2021 13:03:01 +0000 (22:03 +0900)
* src/pgtkterm.c (pgtk_raise_frame): New function.
(pgtk_lower_frame): New function.
(pgtk_frame_raise_lower): New function to call one of those.
(pgtk_create_terminal): Set frame_raise_lower_hook.

src/pgtkterm.c

index c502905926fc186a5f809d96651b773c216bf2e1..ed9d086273faa1077ac07d3caf9207701074bbe4 100644 (file)
@@ -195,6 +195,42 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
 {
 }
 
+/* Raise frame F.  */
+
+static void
+pgtk_raise_frame (struct frame *f)
+{
+  /* This works only for non-child frames on X.
+     It does not work for child frames on X, and it does not work
+     on Wayland too. */
+  block_input ();
+  if (FRAME_VISIBLE_P (f))
+    gdk_window_raise (gtk_widget_get_window (FRAME_WIDGET (f)));
+  unblock_input ();
+}
+
+/* Lower frame F.  */
+
+static void
+pgtk_lower_frame (struct frame *f)
+{
+  if (FRAME_VISIBLE_P (f))
+    {
+      block_input ();
+      gdk_window_lower (gtk_widget_get_window (FRAME_WIDGET (f)));
+      unblock_input ();
+    }
+}
+
+static void
+pgtk_frame_raise_lower (struct frame *f, bool raise_flag)
+{
+  if (raise_flag)
+    pgtk_raise_frame (f);
+  else
+    pgtk_lower_frame (f);
+}
+
 /* Free X resources of frame F.  */
 
 void
@@ -4671,7 +4707,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
   terminal->mouse_position_hook = pgtk_mouse_position;
   terminal->frame_rehighlight_hook = XTframe_rehighlight;
   terminal->buffer_flipping_unblocked_hook = pgtk_buffer_flipping_unblocked_hook;
-  /* terminal->frame_raise_lower_hook = pgtk_frame_raise_lower; */
+  terminal->frame_raise_lower_hook = pgtk_frame_raise_lower;
   terminal->frame_visible_invisible_hook = pgtk_make_frame_visible_invisible;
   terminal->fullscreen_hook = pgtk_fullscreen_hook;
   terminal->menu_show_hook = pgtk_menu_show;