@@ -387,6 +387,11 @@ void Task::handle_title(const char *title) {
387
387
hide_if_ignored ();
388
388
}
389
389
390
+ void Task::set_minimize_hint () {
391
+ zwlr_foreign_toplevel_handle_v1_set_rectangle (handle_, bar_.surface , minimize_hint.x ,
392
+ minimize_hint.y , minimize_hint.w , minimize_hint.h );
393
+ }
394
+
390
395
void Task::hide_if_ignored () {
391
396
if (tbar_->ignore_list ().count (app_id_) || tbar_->ignore_list ().count (title_)) {
392
397
ignored_ = true ;
@@ -447,6 +452,13 @@ void Task::handle_app_id(const char *app_id) {
447
452
spdlog::debug (" Couldn't find icon for {}" , app_id_);
448
453
}
449
454
455
+ void Task::on_button_size_allocated (Gtk::Allocation &alloc) {
456
+ gtk_widget_translate_coordinates (GTK_WIDGET (button.gobj ()), GTK_WIDGET (bar_.window .gobj ()), 0 , 0 ,
457
+ &minimize_hint.x , &minimize_hint.y );
458
+ minimize_hint.w = button.get_width ();
459
+ minimize_hint.h = button.get_height ();
460
+ }
461
+
450
462
void Task::handle_output_enter (struct wl_output *output) {
451
463
if (ignored_) {
452
464
spdlog::debug (" {} is ignored" , repr ());
@@ -457,6 +469,8 @@ void Task::handle_output_enter(struct wl_output *output) {
457
469
458
470
if (!button_visible_ && (tbar_->all_outputs () || tbar_->show_output (output))) {
459
471
/* The task entered the output of the current bar make the button visible */
472
+ button.signal_size_allocate ().connect_notify (
473
+ sigc::mem_fun (this , &Task::on_button_size_allocated));
460
474
tbar_->add_button (button);
461
475
button.show ();
462
476
button_visible_ = true ;
@@ -553,9 +567,11 @@ bool Task::handle_clicked(GdkEventButton *bt) {
553
567
return true ;
554
568
else if (action == " activate" )
555
569
activate ();
556
- else if (action == " minimize" )
570
+ else if (action == " minimize" ) {
571
+ set_minimize_hint ();
557
572
minimize (!minimized ());
558
- else if (action == " minimize-raise" ) {
573
+ } else if (action == " minimize-raise" ) {
574
+ set_minimize_hint ();
559
575
if (minimized ())
560
576
minimize (false );
561
577
else if (active ())
0 commit comments