Skip to content

Commit ca590ba

Browse files
Jeff Walshfejfighter
Jeff Walsh
authored andcommitted
Fix child-frame offsets for negative values
1 parent 5b930c3 commit ca590ba

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/pgtkterm.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -356,33 +356,35 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
356356
External: Position the window
357357
-------------------------------------------------------------------------- */
358358
{
359-
/* not working on wayland. */
360-
361359
PGTK_TRACE("x_set_offset: %d,%d,%d.", xoff, yoff, change_gravity);
362360

363361
struct frame *parent = FRAME_PARENT_FRAME(f);
364362
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 */
368367
GtkWidget *w = FRAME_GTK_WIDGET(parent);
369368
gtk_widget_get_allocation(w, &a);
370369
}
371370

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 {
377377
f->left_pos = xoff + a.x; //~25
378+
}
378379

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
385385
}
386+
f->win_gravity = NorthWestGravity;
387+
}
386388

387389
x_calc_absolute_position (f);
388390

0 commit comments

Comments
 (0)