cliccccccks

This commit is contained in:
WanderingPenwing 2024-08-04 17:47:49 +02:00
parent 14bbe5734b
commit 64073d896c

15
surf.c
View file

@ -365,6 +365,7 @@ static ParamName loadfinished[] = {
/* configuration, allows nested code to access above variables */
#include "config.h"
static gboolean tab_click_received = FALSE;
// Function to free a tab
void free_tab(Tab *tab) {
@ -499,6 +500,15 @@ void new_tab(Client *c, const Arg *a) {
spawn(c, &arg);
}
void tab_bar_click(GtkWidget *w, GdkEvent *e, Client *c) {
if (e->type == GDK_BUTTON_PRESS) {
GdkEventButton *event_button = (GdkEventButton *)e;
g_print("Click at position: (%.0f, %.0f)\n", event_button->x, event_button->y);
} else {
g_print("Event type %d received.\n", e->type);
}
}
void fill_tab_bar(Client *c) {
GdkRGBA fg_color;
gdk_rgba_parse(&fg_color, tab_bar_color[1]);
@ -553,7 +563,6 @@ void create_tab_bar(Client *c) {
c->tab_bar = gtk_grid_new();
gtk_widget_override_background_color(c->tab_bar, GTK_STATE_FLAG_NORMAL, &bg_color);
gtk_widget_set_size_request(c->tab_bar, -1, tab_bar_height); // Set the height of the black bar
gtk_widget_set_events(GTK_GRID(c->tab_bar), GDK_BUTTON_PRESS_MASK);
gtk_grid_set_column_homogeneous(GTK_GRID(c->tab_bar), true);
//int num_tabs = g_list_length(c->tabs);
@ -1736,6 +1745,8 @@ createwindow(Client *c)
char *wmstr;
GtkWidget *w;
g_print("Creating window for client: %p\n", (void *)c);
if (embed) {
w = gtk_plug_new(embed);
} else {
@ -1762,6 +1773,8 @@ createwindow(Client *c)
G_CALLBACK(winevent), c);
g_signal_connect(G_OBJECT(w), "window-state-event",
G_CALLBACK(winevent), c);
g_signal_connect(G_OBJECT(w), "button-press-event",
G_CALLBACK(tab_bar_click), c);
return w;
}