@@ -38,6 +38,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
38
38
39
39
#include "lisp.h"
40
40
#include "blockinput.h"
41
+ #include "frame.h"
41
42
#include "sysselect.h"
42
43
#include "gtkutil.h"
43
44
#include "systime.h"
@@ -355,22 +356,35 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
355
356
External: Position the window
356
357
-------------------------------------------------------------------------- */
357
358
{
358
- /* not working on wayland. */
359
-
360
359
PGTK_TRACE ("x_set_offset: %d,%d,%d." , xoff , yoff , change_gravity );
361
360
362
- if (change_gravity > 0 )
363
- {
364
- PGTK_TRACE ("x_set_offset: change_gravity > 0" );
365
- f -> top_pos = yoff ;
361
+ struct frame * parent = FRAME_PARENT_FRAME (f );
362
+ GtkAllocation a = {0 };
363
+ if (change_gravity > 0 ) {
364
+ if (parent ) {
365
+ /* determing the "height" of the titlebar, by finding the
366
+ location of the "emacsfixed" widget on the surface/window */
367
+ GtkWidget * w = FRAME_GTK_WIDGET (parent );
368
+ gtk_widget_get_allocation (w , & a );
369
+ }
370
+
371
+ f -> size_hint_flags &= ~ (XNegative | YNegative );
372
+ /* if the value is negative, don't include the titlebar offset */
373
+ if (xoff < 0 ) {
374
+ f -> size_hint_flags |= XNegative ;
366
375
f -> left_pos = xoff ;
367
- f -> size_hint_flags &= ~ (XNegative | YNegative );
368
- if (xoff < 0 )
369
- f -> size_hint_flags |= XNegative ;
370
- if (yoff < 0 )
371
- f -> size_hint_flags |= YNegative ;
372
- f -> win_gravity = NorthWestGravity ;
376
+ } else {
377
+ f -> left_pos = xoff + a .x ; //~25
378
+ }
379
+
380
+ if (yoff < 0 ){
381
+ f -> size_hint_flags |= YNegative ;
382
+ f -> top_pos = yoff ;
383
+ } else {
384
+ f -> top_pos = yoff + a .y ; //~60
373
385
}
386
+ f -> win_gravity = NorthWestGravity ;
387
+ }
374
388
375
389
x_calc_absolute_position (f );
376
390
@@ -430,8 +444,6 @@ pgtk_set_window_size (struct frame *f,
430
444
for (GtkWidget * w = FRAME_GTK_WIDGET (f ); w != NULL ; w = gtk_widget_get_parent (w )) {
431
445
gint wd , hi ;
432
446
gtk_widget_get_size_request (w , & wd , & hi );
433
- GtkAllocation alloc ;
434
- gtk_widget_get_allocation (w , & alloc );
435
447
}
436
448
437
449
f -> output_data .pgtk -> preferred_width = pixelwidth ;
@@ -697,13 +709,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
697
709
-------------------------------------------------------------------------- */
698
710
{
699
711
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 );
712
+ PGTK_TRACE ("x_set_parent_frame x: %d, y: %d" , f -> left_pos , f -> top_pos );
707
713
708
714
if (!NILP (new_value )
709
715
&& (!FRAMEP (new_value )
@@ -722,7 +728,6 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
722
728
gtk_window_set_attached_to (FRAME_NATIVE_WINDOW (f ), FRAME_GTK_WIDGET (p ));
723
729
gtk_window_move (FRAME_NATIVE_WINDOW (f ), f -> left_pos , f -> top_pos );
724
730
gtk_window_set_keep_above (FRAME_NATIVE_WINDOW (f ), true);
725
- //fill this in
726
731
unblock_input ();
727
732
728
733
fset_parent_frame (f , new_value );
@@ -815,8 +820,8 @@ pgtk_initialize_display_info (struct pgtk_display_info *dpyinfo)
815
820
Initialize global info and storage for display.
816
821
-------------------------------------------------------------------------- */
817
822
{
818
- dpyinfo -> resx = 72.27 ; /* used 75.0, but this makes pt == pixel, expected */
819
- dpyinfo -> resy = 72.27 ;
823
+ dpyinfo -> resx = 96 ;
824
+ dpyinfo -> resy = 96 ;
820
825
dpyinfo -> color_p = 1 ;
821
826
dpyinfo -> n_planes = 32 ;
822
827
dpyinfo -> root_window = 42 ; /* a placeholder.. */
@@ -2683,7 +2688,6 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
2683
2688
{
2684
2689
PGTK_TRACE ("draw_window_cursor: %d, %d, %d, %d, %d, %d." ,
2685
2690
x , y , cursor_type , cursor_width , on_p , active_p );
2686
-
2687
2691
if (on_p )
2688
2692
{
2689
2693
w -> phys_cursor_type = cursor_type ;
@@ -2732,6 +2736,7 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
2732
2736
xic_set_preeditarea (w , x , y );
2733
2737
#endif
2734
2738
}
2739
+
2735
2740
}
2736
2741
2737
2742
static void
@@ -5390,7 +5395,7 @@ static gboolean window_state_event(GtkWidget *widget, GdkEvent *event, gpointer
5390
5395
5391
5396
if (inev .ie .kind != NO_EVENT )
5392
5397
evq_enqueue (& inev );
5393
- return TRUE ;
5398
+ return FALSE ;
5394
5399
}
5395
5400
5396
5401
static gboolean delete_event (GtkWidget * widget , GdkEvent * event , gpointer * user_data )
@@ -6285,7 +6290,13 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
6285
6290
6286
6291
{
6287
6292
GdkScreen * gscr = gdk_display_get_default_screen (dpyinfo -> gdpy );
6288
- gdouble dpi = gdk_screen_get_resolution (gscr );
6293
+
6294
+ GSettings * set = g_settings_new ("org.gnome.desktop.interface" );
6295
+ gdouble x = g_settings_get_double (set ,"text-scaling-factor" );
6296
+ gdouble dpi = 0 ;
6297
+
6298
+ dpi = 96.0 * x ;
6299
+ gdk_screen_set_resolution (gscr , dpi );
6289
6300
dpyinfo -> resx = dpi ;
6290
6301
dpyinfo -> resy = dpi ;
6291
6302
}
0 commit comments