Ensure the ulock window is not shown when we wait for another instance
This commit is contained in:
parent
a75e92d21c
commit
65268f66f1
1 changed files with 4 additions and 2 deletions
6
ulock.c
6
ulock.c
|
@ -33,7 +33,7 @@ enum lock_state {
|
||||||
static enum lock_state state = LOCKED;
|
static enum lock_state state = LOCKED;
|
||||||
|
|
||||||
static GtkWidget *window, *unlockWindow, *lockLabel, *promptEntry, *messageLabel, *logoutButton, *unlockButton;
|
static GtkWidget *window, *unlockWindow, *lockLabel, *promptEntry, *messageLabel, *logoutButton, *unlockButton;
|
||||||
static gboolean enablePromptEntry = TRUE, enableLogoutButton = FALSE, enableUnlockButton = TRUE;
|
static gboolean present = FALSE, enablePromptEntry = TRUE, enableLogoutButton = FALSE, enableUnlockButton = TRUE;
|
||||||
|
|
||||||
static char *username;
|
static char *username;
|
||||||
static char *logoutCommand = NULL;
|
static char *logoutCommand = NULL;
|
||||||
|
@ -213,7 +213,7 @@ static GdkFilterReturn xevent_filter(GdkXEvent *xevent, GdkEvent *event, gpointe
|
||||||
switch (ev->xany.type) {
|
switch (ev->xany.type) {
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
if (ev->xany.window != gdk_x11_window_get_xid(gtk_widget_get_window(window)))
|
if (present && ev->xany.window != gdk_x11_window_get_xid(gtk_widget_get_window(window)))
|
||||||
gtk_window_present(GTK_WINDOW(window));
|
gtk_window_present(GTK_WINDOW(window));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -346,6 +346,8 @@ int main(int argc, char *argv[]) {
|
||||||
load_config();
|
load_config();
|
||||||
|
|
||||||
create_lock_window();
|
create_lock_window();
|
||||||
|
|
||||||
|
present = TRUE;
|
||||||
gtk_widget_show(window);
|
gtk_widget_show(window);
|
||||||
|
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
|
Reference in a new issue