@@ -356,33 +356,35 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
356
356
External: Position the window
357
357
-------------------------------------------------------------------------- */
358
358
{
359
- /* not working on wayland. */
360
-
361
359
PGTK_TRACE ("x_set_offset: %d,%d,%d." , xoff , yoff , change_gravity );
362
360
363
361
struct frame * parent = FRAME_PARENT_FRAME (f );
364
362
GtkAllocation a = {0 };
365
-
366
- if (parent )
367
- {
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 */
368
367
GtkWidget * w = FRAME_GTK_WIDGET (parent );
369
368
gtk_widget_get_allocation (w , & a );
370
369
}
371
370
372
-
373
- if (change_gravity > 0 )
374
- {
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
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 ;
375
+ f -> left_pos = xoff ;
376
+ } else {
377
377
f -> left_pos = xoff + a .x ; //~25
378
+ }
378
379
379
- f -> size_hint_flags &= ~ (XNegative | YNegative );
380
- if (xoff < 0 )
381
- f -> size_hint_flags |= XNegative ;
382
- if (yoff < 0 )
383
- f -> size_hint_flags |= YNegative ;
384
- f -> win_gravity = NorthWestGravity ;
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
385
385
}
386
+ f -> win_gravity = NorthWestGravity ;
387
+ }
386
388
387
389
x_calc_absolute_position (f );
388
390
0 commit comments