0

I try to use HEADERBAR, but cannot found information about how add it to non-toplevel-window/widget. I need to allow user to move window, but only in certain condition (when user invokes specific window mode). I see Firefox work with PIP (Picture-In-Pictrue mode) with that. How?

I use this code:

GtkHeaderBar *HB = gtk_header_bar_new();
GtkBox *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
  
  
gtk_box_pack_start(box, HB, 0, 0, 0);
gtk_overlay_add_overlay(p, box);
gtk_widget_show_all(box);

It do not work. I see Box layout (I see background on top of other widget), but no headerbar.

nintyfan
  • 386
  • 3
  • 16

1 Answers1

0

I found an simple solution. It can be done by place whole window content into single container. When need to switch to allow drag window by pressing content, simply reparent container to headerbar. I remember that I was trying this. Any way - right click menu still do not work - I need menu of titlebar, not widget inside window. I also wonder, how KDE dev achieve this. I think, KDE team does not place whole window into headerbar.

nintyfan
  • 386
  • 3
  • 16
  • In other word: how to achieve similar effect in low-level, without using GTK or with implementing something similar to headerbar using GTK. – nintyfan Oct 31 '22 at 14:06