GList *layout_window_list = NULL;
-
+LayoutWindow *current_lw = NULL;
static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle);
{
if (*lw == NULL)
{
- if (layout_window_list) *lw = layout_window_list->data;
+ if (current_lw) *lw = current_lw;
+ else if (layout_window_list) *lw = layout_window_list->data;
return (*lw != NULL);
}
-
return (g_list_find(layout_window_list, *lw) != NULL);
}
GList *work;
if (!id || !id[0]) return NULL;
+
+ if (strcmp(id, LAYOUT_ID_CURRENT) == 0)
+ {
+ if (current_lw) return current_lw;
+ if (layout_window_list) return layout_window_list->data;
+ return NULL;
+ }
+
work = layout_window_list;
while (work)
{
}
}
+static gboolean layout_set_current_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data)
+{
+ LayoutWindow *lw = data;
+ current_lw = lw;
+ return FALSE;
+}
+
/*
*-----------------------------------------------------------------------------
* menu, toolbar, and dir view
if (!lw) return;
layout_window_list = g_list_remove(layout_window_list, lw);
+ if (current_lw == lw) current_lw = NULL;
if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw);
g_signal_connect(G_OBJECT(lw->window), "delete_event",
G_CALLBACK(layout_delete_cb), lw);
+ g_signal_connect(G_OBJECT(lw->window), "focus-in-event",
+ G_CALLBACK(layout_set_current_cb), lw);
+
layout_keyboard_init(lw, lw->window);
#ifdef HAVE_LIRC
void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values)
{
+ gchar *id = NULL;
while (*attribute_names)
{
const gchar *value = *attribute_values++;
/* layout options */
- if (READ_CHAR(*layout, id)) continue;
+ if (READ_CHAR_FULL("id", id)) continue;
if (READ_INT(*layout, style)) continue;
if (READ_CHAR(*layout, order)) continue;
log_printf("unknown attribute %s = %s\n", option, value);
}
-
+ if (id && strcmp(id, LAYOUT_ID_CURRENT) != 0)
+ {
+ g_free(layout->id);
+ layout->id = id;
+ }
+ else
+ {
+ g_free(id);
+ }
}
static void layout_config_commandline(LayoutOptions *lop, gchar **path)