pause trying to make click work
This commit is contained in:
parent
380edc0804
commit
4f0d15c621
51
surf.c
51
surf.c
|
@ -389,25 +389,28 @@ void free_all_tabs(Client *client) {
|
||||||
client->tabs = NULL;
|
client->tabs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* create_tab_bar_view(GList *tabs, int selected_tab, GtkWidget *tab_bar) {
|
void tab_bar_click(GtkWidget *w, GdkEvent *e, Client *c) {
|
||||||
|
g_print("yay");
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget* create_tab_bar_view(Client *c) {
|
||||||
|
g_print("hello there\n\n");
|
||||||
GdkRGBA bg_color, fg_color;
|
GdkRGBA bg_color, fg_color;
|
||||||
gdk_rgba_parse(&bg_color, tab_bar_color[0]);
|
gdk_rgba_parse(&bg_color, tab_bar_color[0]);
|
||||||
gdk_rgba_parse(&fg_color, tab_bar_color[1]);
|
gdk_rgba_parse(&fg_color, tab_bar_color[1]);
|
||||||
|
|
||||||
GtkWidget *tab_bar_container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
GtkWidget *tab_bar = gtk_grid_new();
|
||||||
gtk_widget_set_size_request(tab_bar_container, -1, tab_bar_height + tab_spacer_height);
|
|
||||||
|
|
||||||
tab_bar = gtk_grid_new();
|
|
||||||
gtk_widget_override_background_color(tab_bar, GTK_STATE_FLAG_NORMAL, &bg_color);
|
gtk_widget_override_background_color(tab_bar, GTK_STATE_FLAG_NORMAL, &bg_color);
|
||||||
gtk_widget_set_size_request(tab_bar, -1, tab_bar_height); // Set the height of the black bar
|
gtk_widget_set_size_request(tab_bar, -1, tab_bar_height); // Set the height of the black bar
|
||||||
gtk_grid_set_column_spacing(tab_bar, 10);
|
gtk_grid_set_column_spacing(tab_bar, 10);
|
||||||
|
gtk_widget_set_events(GTK_GRID(tab_bar), GDK_BUTTON_PRESS_MASK);
|
||||||
|
|
||||||
//int num_tabs = g_list_length(tabs);
|
//int num_tabs = g_list_length(c->tabs);
|
||||||
//int num_parts = MAX(num_tabs + 1, 6); // Determine the number of parts (max(6, num_tabs + 1))
|
//int num_parts = MAX(num_tabs + 1, 6); // Determine the number of parts (max(6, num_tabs + 1))
|
||||||
|
|
||||||
int tab_index = 0;
|
int tab_index = 0;
|
||||||
// Add tabs to the tab bar
|
// Add tabs to the tab bar
|
||||||
for (GList *l = tabs; l != NULL; l = l->next) {
|
for (GList *l = c->tabs; l != NULL; l = l->next) {
|
||||||
Tab *tab = (Tab *)l->data;
|
Tab *tab = (Tab *)l->data;
|
||||||
GtkWidget *label = gtk_label_new(tab->title);
|
GtkWidget *label = gtk_label_new(tab->title);
|
||||||
|
|
||||||
|
@ -415,7 +418,7 @@ GtkWidget* create_tab_bar_view(GList *tabs, int selected_tab, GtkWidget *tab_bar
|
||||||
gtk_widget_set_margin_start(label, 5);
|
gtk_widget_set_margin_start(label, 5);
|
||||||
gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_size_request(label, -1, tab_bar_height);
|
gtk_widget_set_size_request(label, -1, tab_bar_height);
|
||||||
if (tab_index == selected_tab) {
|
if (tab_index == c->selected_tab) {
|
||||||
gtk_widget_override_background_color(label, GTK_STATE_FLAG_NORMAL, &fg_color);
|
gtk_widget_override_background_color(label, GTK_STATE_FLAG_NORMAL, &fg_color);
|
||||||
}
|
}
|
||||||
gtk_grid_attach_next_to(GTK_GRID(tab_bar), label, NULL, GTK_POS_RIGHT, 1, 1); // Pack the label into the box
|
gtk_grid_attach_next_to(GTK_GRID(tab_bar), label, NULL, GTK_POS_RIGHT, 1, 1); // Pack the label into the box
|
||||||
|
@ -429,15 +432,10 @@ GtkWidget* create_tab_bar_view(GList *tabs, int selected_tab, GtkWidget *tab_bar
|
||||||
gtk_grid_attach_next_to(GTK_GRID(tab_bar), new_tab, NULL, GTK_POS_RIGHT, 1, 1);
|
gtk_grid_attach_next_to(GTK_GRID(tab_bar), new_tab, NULL, GTK_POS_RIGHT, 1, 1);
|
||||||
gtk_widget_show(new_tab);
|
gtk_widget_show(new_tab);
|
||||||
|
|
||||||
GtkWidget *spacer = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
g_signal_connect(G_OBJECT(tab_bar), "button-release-event",
|
||||||
gtk_widget_override_background_color(spacer, GTK_STATE_FLAG_NORMAL, &fg_color);
|
G_CALLBACK(tab_bar_click), c);
|
||||||
gtk_widget_set_size_request(spacer, -1, tab_spacer_height);
|
|
||||||
gtk_widget_show(spacer);
|
|
||||||
|
|
||||||
gtk_box_pack_start(GTK_BOX(tab_bar_container), tab_bar, FALSE, FALSE, 0);
|
return tab_bar;
|
||||||
gtk_box_pack_start(GTK_BOX(tab_bar_container), spacer, FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
return tab_bar_container;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -687,16 +685,18 @@ newclient(Client *rc)
|
||||||
clients = c;
|
clients = c;
|
||||||
|
|
||||||
c->progress = 100;
|
c->progress = 100;
|
||||||
c->view = newview(c, rc ? rc->view : NULL);
|
|
||||||
|
|
||||||
// Initialize the tabs with "General" and "Kenobi"
|
// Initialize the tabs with "General" and "Kenobi"
|
||||||
Tab *tab1 = create_tab("General", "about:blank");
|
Tab *tab1 = create_tab("General", "about:blank");
|
||||||
Tab *tab2 = create_tab("Kenobi", "about:blank");
|
Tab *tab2 = create_tab("Kenobi", "about:blank");
|
||||||
add_tab(c, tab1);
|
add_tab(c, tab1);
|
||||||
add_tab(c, tab2);
|
add_tab(c, tab2);
|
||||||
|
|
||||||
c->selected_tab = 0;
|
c->selected_tab = 0;
|
||||||
|
|
||||||
|
c->tab_bar = create_tab_bar_view(c);
|
||||||
|
|
||||||
|
c->view = newview(c, rc ? rc->view : NULL);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,6 +1375,7 @@ newview(Client *c, WebKitWebView *rv)
|
||||||
g_signal_connect(G_OBJECT(v), "web-process-terminated",
|
g_signal_connect(G_OBJECT(v), "web-process-terminated",
|
||||||
G_CALLBACK(webprocessterminated), c);
|
G_CALLBACK(webprocessterminated), c);
|
||||||
|
|
||||||
|
|
||||||
c->context = context;
|
c->context = context;
|
||||||
c->settings = settings;
|
c->settings = settings;
|
||||||
|
|
||||||
|
@ -1537,7 +1538,19 @@ showview(WebKitWebView *v, Client *c)
|
||||||
GdkWindow *gwin;
|
GdkWindow *gwin;
|
||||||
|
|
||||||
// Create the black bar using the separate function
|
// Create the black bar using the separate function
|
||||||
GtkWidget *tab_bar_container = create_tab_bar_view(c->tabs, c->selected_tab, c->tab_bar);
|
GdkRGBA fg_color;
|
||||||
|
gdk_rgba_parse(&fg_color, tab_bar_color[1]);
|
||||||
|
|
||||||
|
GtkWidget *tab_bar_container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
gtk_widget_set_size_request(tab_bar_container, -1, tab_bar_height + tab_spacer_height);
|
||||||
|
|
||||||
|
GtkWidget *spacer = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
gtk_widget_override_background_color(spacer, GTK_STATE_FLAG_NORMAL, &fg_color);
|
||||||
|
gtk_widget_set_size_request(spacer, -1, tab_spacer_height);
|
||||||
|
gtk_widget_show(spacer);
|
||||||
|
|
||||||
|
gtk_box_pack_start(GTK_BOX(tab_bar_container), c->tab_bar, FALSE, FALSE, 0);
|
||||||
|
gtk_box_pack_start(GTK_BOX(tab_bar_container), spacer, FALSE, FALSE, 0);
|
||||||
|
|
||||||
// Create a container to hold the black bar and the WebKitWebView
|
// Create a container to hold the black bar and the WebKitWebView
|
||||||
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
|
Loading…
Reference in a new issue