GtkNotebook does not refresh the UI after dragging tab outside window (visual bug)
Using the following code
#include <gtk/gtk.h>
static GtkWidget * menubutton;
static GMenu * menu = NULL;
static void
activate (GtkApplication *app,
gpointer user_data)
{
GtkWidget *window;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
GtkWidget * notebook = gtk_notebook_new ();
GtkWidget * label = gtk_label_new ("tab label");
GtkWidget * button = gtk_button_new_with_label ("Hello World");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), button, label);
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), button, true);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook), button, true);
label = gtk_label_new ("tab label");
button = gtk_button_new_with_label ("Hello World");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), button, label);
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), button, true);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook), button, true);
gtk_window_set_child (GTK_WINDOW (window), notebook);
gtk_window_present (GTK_WINDOW (window));
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
Steps to reproduce
- Click and drag one of the tabs towards the middle then outside of the window, then release the mouse button to end the drag.
- Observe that the GtkNotebook is stuck visually as if it was mid-drag
After releasing outside window (at this point the tab should return to its original position but it doesn't):
The tab is returned to its normal position only after clicking another tab:
This is just a visual bug so probably not high priority
Version
GTK 4.4.0 on Arch Linux + wayland
Edited by alex-tee