Skip to content

Commit

Permalink
register all windows as application windows to keep application running
Browse files Browse the repository at this point in the history
  • Loading branch information
LBCrion committed Feb 2, 2024
1 parent 58f57eb commit 15668dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ G_DEFINE_TYPE_WITH_CODE (Bar, bar, GTK_TYPE_WINDOW, G_ADD_PRIVATE (Bar))

static GHashTable *bar_list;
static GList *mirrors;
extern GtkApplication *application;

static gboolean bar_sensor_unblock_cb ( GtkWidget *self )
{
Expand Down Expand Up @@ -747,6 +748,7 @@ GtkWidget *bar_new ( gchar *name )
BarPrivate *priv;

self = GTK_WIDGET(g_object_new(bar_get_type(), NULL));
gtk_application_add_window(application, GTK_WINDOW(self));
priv = bar_get_instance_private(BAR(self));
priv->name = g_strdup(name);
priv->visible = TRUE;
Expand Down
3 changes: 2 additions & 1 deletion src/sfwbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

extern gchar *confname;
extern gchar *sockname;
extern GtkApplication *application;

static gchar *cssname;
static gchar *monitor;
Expand Down Expand Up @@ -121,6 +122,7 @@ static void activate (GtkApplication* app, gpointer data )
GdkDisplay *gdisp;
GList *clist, *iter;

application = app;
expr_lib_init();
action_lib_init();
css_init(cssname);
Expand All @@ -147,7 +149,6 @@ static void activate (GtkApplication* app, gpointer data )
for(iter = clist; iter; iter = g_list_next(iter) )
if(GTK_IS_BOX(gtk_bin_get_child(GTK_BIN(iter->data))))
{
gtk_application_add_window(app,GTK_WINDOW(iter->data));
css_widget_cascade(GTK_WIDGET(iter->data),NULL);
base_widget_autoexec(iter->data,NULL);
if(monitor)
Expand Down
4 changes: 3 additions & 1 deletion src/switcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static gint counter;
static gint title_width = -1;
static window_t *focus;

GtkApplication *application;

static GtkWidget *switcher_get_child ( GtkWidget *self )
{
SwitcherPrivate *priv;
Expand Down Expand Up @@ -67,7 +69,7 @@ GtkWidget *switcher_new ( void )
{
grid = self;
gtk_widget_set_name(base_widget_get_child(grid), "switcher");
switcher = gtk_window_new(GTK_WINDOW_TOPLEVEL);
switcher = gtk_application_window_new(application);
gtk_layer_init_for_window (GTK_WINDOW(switcher));
gtk_layer_set_layer(GTK_WINDOW(switcher),GTK_LAYER_SHELL_LAYER_OVERLAY);
gtk_widget_set_name(switcher, "switcher");
Expand Down

0 comments on commit 15668dc

Please sign in to comment.