Skip to content

Commit 81a82cc

Browse files
Jeff Walshfejfighter
authored andcommitted
Some work toward posframe on wayland
hacky GTK offsets taht will need better calculations
1 parent ce60c1c commit 81a82cc

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

src/gtkutil.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ xg_create_frame_widgets (struct frame *f)
13261326
#ifndef HAVE_GTK3
13271327
GtkRcStyle *style;
13281328
#endif
1329+
GtkWindowType type = GTK_WINDOW_TOPLEVEL;
13291330
char *title = 0;
13301331

13311332
PGTK_TRACE("xg_create_frame_widgets.");
@@ -1339,9 +1340,17 @@ xg_create_frame_widgets (struct frame *f)
13391340
}
13401341
else
13411342
#endif
1342-
wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1343+
1344+
#ifdef HAVE_PGTK
1345+
if (!NILP(f->parent_frame)){
1346+
type = GTK_WINDOW_POPUP;
1347+
}
1348+
#endif
1349+
1350+
wtop = gtk_window_new (type);
13431351
#ifdef HAVE_PGTK
1344-
gtk_widget_add_events(wtop, GDK_ALL_EVENTS_MASK);
1352+
gtk_widget_add_events(wtop, GDK_ALL_EVENTS_MASK);
1353+
gtk_window_set_hide_titlebar_when_maximized(wtop, TRUE);
13451354
#endif
13461355

13471356
/* gtk_window_set_has_resize_grip is a Gtk+ 3.0 function but Ubuntu
@@ -1467,7 +1476,7 @@ xg_create_frame_widgets (struct frame *f)
14671476
#ifndef HAVE_PGTK
14681477
gtk_widget_realize (wfixed);
14691478
#else
1470-
gtk_widget_show_all(wtop);
1479+
// gtk_widget_show_all(wtop);
14711480
#endif
14721481
#ifndef HAVE_PGTK
14731482
FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (wfixed);

src/pgtkfns.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ frame_parm_handler pgtk_frame_parm_handlers[] =
915915
pgtk_set_tool_bar_position,
916916
0, /* x_set_inhibit_double_buffering */
917917
x_set_undecorated,
918-
0, /* x_set_parent_frame, */
918+
x_set_parent_frame,
919919
x_set_skip_taskbar,
920920
x_set_no_focus_on_map,
921921
x_set_no_accept_focus,
@@ -1454,17 +1454,21 @@ This function is an internal primitive--use `make-frame' instead. */)
14541454
gui_default_parameter (f, parms, Qalpha, Qnil,
14551455
"alpha", "Alpha", RES_TYPE_NUMBER);
14561456

1457-
#if 0
14581457
if (!NILP (parent_frame))
14591458
{
14601459
struct frame *p = XFRAME (parent_frame);
14611460

14621461
block_input ();
1463-
XReparentWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
1464-
FRAME_X_WINDOW (p), f->left_pos, f->top_pos);
1462+
APGTK_TRACE ("x_set_parent_frame x: %d, y: %d, size: %d x %d", f->left_pos, f->top_pos, -1,-1);
1463+
gtk_window_set_transient_for(FRAME_GTK_OUTER_WIDGET(f), FRAME_GTK_OUTER_WIDGET(p));
1464+
gtk_window_set_attached_to(FRAME_GTK_OUTER_WIDGET(f), FRAME_GTK_OUTER_WIDGET(p));
1465+
1466+
gtk_widget_show_all(FRAME_GTK_OUTER_WIDGET(f));
1467+
APGTK_TRACE ("FINISH: x_set_parent_frame x: %d, y: %d, size: %d x %d", f->left_pos, f->top_pos, -1,-1);
14651468
unblock_input ();
14661469
}
1467-
#endif
1470+
1471+
gtk_widget_show_all(FRAME_GTK_OUTER_WIDGET(f));
14681472

14691473
gui_default_parameter (f, parms, Qno_focus_on_map, Qnil,
14701474
NULL, NULL, RES_TYPE_BOOLEAN);
@@ -3158,7 +3162,7 @@ When using Gtk+ tooltips, the tooltip face is not used. */);
31583162
DEFSYM (Qreverse_landscape, "reverse-landscape");
31593163
}
31603164

3161-
#ifdef PGTK_DEBUG
3165+
31623166

31633167
#include <stdarg.h>
31643168
#include <time.h>
@@ -3210,7 +3214,7 @@ void pgtk_backtrace(const char *file, int lineno)
32103214

32113215
fprintf(stderr, "%s %.10s:%04d ********\n", timestr, file, lineno);
32123216
}
3213-
3217+
#ifdef PGTK_DEBUG
32143218
#endif
32153219

32163220
#endif

src/pgtkterm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,13 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
357357
{
358358
/* not working on wayland. */
359359

360-
PGTK_TRACE("x_set_offset: %d,%d,%d.", xoff, yoff, change_gravity);
360+
APGTK_TRACE("x_set_offset: %d,%d,%d.", xoff, yoff, change_gravity);
361361

362362
if (change_gravity > 0)
363363
{
364-
PGTK_TRACE("x_set_offset: change_gravity > 0");
365-
f->top_pos = yoff;
366-
f->left_pos = xoff;
364+
APGTK_TRACE("x_set_offset: change_gravity > 0");
365+
f->top_pos = yoff+60;
366+
f->left_pos = xoff + 25;
367367
f->size_hint_flags &= ~ (XNegative | YNegative);
368368
if (xoff < 0)
369369
f->size_hint_flags |= XNegative;
@@ -381,7 +381,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
381381
has been realized already, leave it to gtk_window_move to DTRT
382382
and return. Used for Bug#25851 and Bug#25943. */
383383
if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f)) {
384-
PGTK_TRACE("x_set_offset: move to %d,%d.", f->left_pos, f->top_pos);
384+
APGTK_TRACE("x_set_offset: move to %d,%d.", f->left_pos, f->top_pos);
385385
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
386386
f->left_pos, f->top_pos);
387387
}

0 commit comments

Comments
 (0)