aboutsummaryrefslogtreecommitdiff
path: root/swt.c
diff options
context:
space:
mode:
Diffstat (limited to 'swt.c')
-rw-r--r--swt.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/swt.c b/swt.c
index e4aacfd..6174275 100644
--- a/swt.c
+++ b/swt.c
@@ -13,6 +13,7 @@
#include <errno.h>
#include <stdlib.h>
#include <locale.h>
+#include <ctype.h>
char *argv0;
#include "wayland.h"
@@ -100,6 +101,7 @@ static void data_device_data_offer(void *data, struct wl_data_device *data_devic
static void data_source_send(void *data, struct wl_data_source *source, const char *mime_type, int fd);
static void data_source_cancelled(void *data, struct wl_data_source *source);
static void dummy() {}
+static int is_valid_title(const char *title);
/* global variables */
@@ -413,9 +415,36 @@ wseticontitle(char *title) {
}
+int
+is_valid_title(const char *title)
+{
+ int i = 0;
+
+ if (!title)
+ return 0;
+
+ fprintf(stderr, "HERE\n");
+ for (; i < STR_BUF_SIZ; ++i) {
+ if (title[i] == 0) {
+ return 1;
+ }
+ }
+
+ fprintf(stderr, "FALSE\n");
+
+ return 0;
+}
+
+
void
wsettitle(char *title) {
- xdg_toplevel_set_title(win.surface.toplevel, title);
+ if (is_valid_title(title)) {
+ fprintf(stderr, "TRUE\n");
+ xdg_toplevel_set_title(win.surface.toplevel, title);
+ fprintf(stderr, "SET TITLE\n");
+ } else {
+ xdg_toplevel_set_title(win.surface.toplevel, "swt");
+ }
}