summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/notepad.c15
-rw-r--r--src/wayland/shell.c4
2 files changed, 9 insertions, 10 deletions
diff --git a/examples/notepad.c b/examples/notepad.c
index 2d20039..beb7051 100644
--- a/examples/notepad.c
+++ b/examples/notepad.c
@@ -354,6 +354,9 @@ static void *worker_thread(void *arg)
}
}
+ if (!ed->worker_running)
+ break;
+
struct doc_stats *s = malloc(sizeof(*s));
if (s) {
s->words = word_count;
@@ -1087,6 +1090,8 @@ static int on_event(void *ud, const struct yasl_event *ev)
/* Shortcuts */
if (ctrl) {
switch (ev->key.key) {
+ case YASL_KEY_Q:
+ return YASL_APP_QUIT;
case YASL_KEY_N:
editor_new_file(ed);
yasl_surface_request_frame(ed->surface);
@@ -1394,14 +1399,6 @@ static int on_event(void *ud, const struct yasl_event *ev)
break;
case YASL_EVENT_WINDOW_CLOSE_REQUEST:
- if (ed->is_modified && ed->prompt != PROMPT_CONFIRM_QUIT) {
- ed->prompt = PROMPT_CONFIRM_QUIT;
- ed->prompt_len = 0;
- ed->prompt_buf[0] = '\0';
- editor_set_status(ed, "Save changes before exit? (y/n/esc)");
- yasl_surface_request_frame(ed->surface);
- return YASL_APP_CONTINUE;
- }
return YASL_APP_QUIT;
default:
@@ -1562,7 +1559,7 @@ static void on_quit(void *ud, struct yasl_display *d)
struct editor *ed = ud;
ed->worker_running = false;
pthread_mutex_lock(&ed->worker_mutex);
- pthread_cond_signal(&ed->worker_cond);
+ pthread_cond_broadcast(&ed->worker_cond);
pthread_mutex_unlock(&ed->worker_mutex);
pthread_join(ed->worker_tid, NULL);
pthread_mutex_destroy(&ed->worker_mutex);
diff --git a/src/wayland/shell.c b/src/wayland/shell.c
index 10af712..4c1caad 100644
--- a/src/wayland/shell.c
+++ b/src/wayland/shell.c
@@ -311,7 +311,9 @@ static void toplevel_configure(void *data, struct xdg_toplevel *toplevel,
static void toplevel_close(void *data, struct xdg_toplevel *toplevel)
{
(void)toplevel;
- surface_fail(data);
+ struct wayland_surface *w = data;
+ if (w && w->cbs && w->cbs->close)
+ w->cbs->close(&w->base, w->ud);
}
static void toplevel_configure_bounds(void *data, struct xdg_toplevel *toplevel,