@@ -38,6 +38,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
3838
3939#include "lisp.h"
4040#include "blockinput.h"
41+ #include "frame.h"
4142#include "sysselect.h"
4243#include "gtkutil.h"
4344#include "systime.h"
@@ -357,13 +358,24 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
357358{
358359 /* not working on wayland. */
359360
360- APGTK_TRACE ("x_set_offset: %d,%d,%d." , xoff , yoff , change_gravity );
361+ PGTK_TRACE ("x_set_offset: %d,%d,%d." , xoff , yoff , change_gravity );
362+
363+ struct frame * parent = FRAME_PARENT_FRAME (f );
364+ GtkAllocation a = {0 };
365+
366+ if (parent )
367+ {
368+ GtkWidget * w = FRAME_GTK_WIDGET (parent );
369+ gtk_widget_get_allocation (w , & a );
370+ }
371+
361372
362373 if (change_gravity > 0 )
363374 {
364- APGTK_TRACE ("x_set_offset: change_gravity > 0" );
365- f -> top_pos = yoff + 60 ;
366- f -> left_pos = xoff + 25 ;
375+ PGTK_TRACE ("x_set_offset: change_gravity %d > 0, %d %d" , change_gravity , a .x , a .y );
376+ f -> top_pos = yoff + a .y ; //~60
377+ f -> left_pos = xoff + a .x ; //~25
378+
367379 f -> size_hint_flags &= ~ (XNegative | YNegative );
368380 if (xoff < 0 )
369381 f -> size_hint_flags |= XNegative ;
@@ -381,7 +393,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
381393 has been realized already, leave it to gtk_window_move to DTRT
382394 and return. Used for Bug#25851 and Bug#25943. */
383395 if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f )) {
384- APGTK_TRACE ("x_set_offset: move to %d,%d." , f -> left_pos , f -> top_pos );
396+ PGTK_TRACE ("x_set_offset: move to %d,%d." , f -> left_pos , f -> top_pos );
385397 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f )),
386398 f -> left_pos , f -> top_pos );
387399 }
@@ -430,8 +442,6 @@ pgtk_set_window_size (struct frame *f,
430442 for (GtkWidget * w = FRAME_GTK_WIDGET (f ); w != NULL ; w = gtk_widget_get_parent (w )) {
431443 gint wd , hi ;
432444 gtk_widget_get_size_request (w , & wd , & hi );
433- GtkAllocation alloc ;
434- gtk_widget_get_allocation (w , & alloc );
435445 }
436446
437447 f -> output_data .pgtk -> preferred_width = pixelwidth ;
@@ -697,13 +707,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
697707 -------------------------------------------------------------------------- */
698708{
699709 struct frame * p = NULL ;
700- int width = 0 , height = 0 ;
701-
702- PGTK_TRACE ("x_set_parent_frame x: %d, y: %d, size: %d x %d" , f -> left_pos , f -> top_pos , width , height );
703- gtk_window_get_size (FRAME_NATIVE_WINDOW (f ), & width , & height );
704-
705-
706- PGTK_TRACE ("x_set_parent_frame x: %d, y: %d, size: %d x %d" , f -> left_pos , f -> top_pos , width , height );
710+ PGTK_TRACE ("x_set_parent_frame x: %d, y: %d" , f -> left_pos , f -> top_pos );
707711
708712 if (!NILP (new_value )
709713 && (!FRAMEP (new_value )
@@ -722,7 +726,6 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
722726 gtk_window_set_attached_to (FRAME_NATIVE_WINDOW (f ), FRAME_GTK_WIDGET (p ));
723727 gtk_window_move (FRAME_NATIVE_WINDOW (f ), f -> left_pos , f -> top_pos );
724728 gtk_window_set_keep_above (FRAME_NATIVE_WINDOW (f ), true);
725- //fill this in
726729 unblock_input ();
727730
728731 fset_parent_frame (f , new_value );
@@ -2683,7 +2686,6 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
26832686{
26842687 PGTK_TRACE ("draw_window_cursor: %d, %d, %d, %d, %d, %d." ,
26852688 x , y , cursor_type , cursor_width , on_p , active_p );
2686-
26872689 if (on_p )
26882690 {
26892691 w -> phys_cursor_type = cursor_type ;
@@ -2732,6 +2734,7 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
27322734 xic_set_preeditarea (w , x , y );
27332735#endif
27342736 }
2737+
27352738}
27362739
27372740static void
0 commit comments