]> git.mdlowis.com Git - projs/tide.git/commitdiff
Cleaned up win interface slightly
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 10 Aug 2017 18:46:41 +0000 (14:46 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 10 Aug 2017 18:46:41 +0000 (14:46 -0400)
inc/win.h
lib/win.c
pick.c
tests/tide.c
tide.c

index a54f0aaa86ffabf0580106c83bf71dcab0490dfa..70f73b96aed9569843b2880dd4414108af677556 100644 (file)
--- a/inc/win.h
+++ b/inc/win.h
@@ -38,8 +38,7 @@ typedef struct {
     MouseFunc right;
 } MouseConfig;
 
-void win_window(char* name, void (*errfn)(char*));
-void win_dialog(char* name, void (*errfn)(char*));
+void win_window(char* name, bool isdialog, void (*errfn)(char*));
 void win_loop(void);
 void win_settext(WinRegion id, char* text);
 void win_setlinenums(bool enable);
@@ -67,5 +66,3 @@ void onscroll(double percent);
 void onmouseleft(WinRegion id, bool pressed, size_t row, size_t col);
 void onmousemiddle(WinRegion id, bool pressed, size_t row, size_t col);
 void onmouseright(WinRegion id, bool pressed, size_t row, size_t col);
-bool update_needed(void);
-
index 7b6275dce88e8e73fcd2e31a69c62e7ce94fc3cf..85cf96ed9449ab31adbdf9304b729fc71cf403ca 100644 (file)
--- a/lib/win.c
+++ b/lib/win.c
@@ -50,14 +50,12 @@ static void win_init(void (*errfn)(char*)) {
     Regions[EDIT].clrcsr = config_get_int(ClrEditCsr);
 }
 
-void win_window(char* name, void (*errfn)(char*)) {
+void win_window(char* name, bool isdialog, void (*errfn)(char*)) {
     win_init(errfn);
-    x11_window(name, config_get_int(WinWidth), config_get_int(WinHeight));
-}
-
-void win_dialog(char* name, void (*errfn)(char*)) {
-    win_init(errfn);
-    x11_dialog(name, config_get_int(WinWidth), config_get_int(WinHeight));
+    if (isdialog)
+        x11_dialog(name, config_get_int(WinWidth), config_get_int(WinHeight));
+    else
+        x11_window(name, config_get_int(WinWidth), config_get_int(WinHeight));
 }
 
 static void win_update(int xfd, void* data) {
diff --git a/pick.c b/pick.c
index 6d1ada575a53f8120ecdbdc79424dbaf4d49aecd..8892f1d2c2704d673101c7b0b33cb97d8b63b3c5 100644 (file)
--- a/pick.c
+++ b/pick.c
@@ -172,10 +172,6 @@ void onshutdown(void) {
     x11_deinit();
 }
 
-bool update_needed(void) {
-    return false;
-}
-
 /* Main Routine
  *****************************************************************************/
 static void onerror(char* msg) {
@@ -229,7 +225,7 @@ int main(int argc, char** argv) {
     char* title = getenv("PICKTITLE");
     load_choices();
     if (vec_size(&Choices) > 1) {
-        win_dialog("pick", onerror);
+        win_dialog("pick", true, onerror);
         win_setkeys(Bindings, NULL);
         win_settext(STATUS, (title ? title : "pick"));
         if (argc >= 2) {
index 8af7b28182cd8c9a185bfe7a9a1c86f1e4ce765a..24164776fe48e0c4932eb64e57212110f7b90ead 100644 (file)
@@ -23,7 +23,7 @@ Display* XDisplay;
 
 static void initialize(void) {
     ShellCmd[0] = "/bin/sh";
-    win_window("edit", ondiagmsg);
+    win_window("edit", false, ondiagmsg);
     XDisplay = XOpenDisplay(NULL);
     win_setkeys(Bindings, NULL);
 }
diff --git a/tide.c b/tide.c
index 915f5e4e1a1fb0974240ef2dfdac3a5616e9b81a..00327b1a6367bf6c2522592be15394aabbc468c0 100644 (file)
--- a/tide.c
+++ b/tide.c
@@ -527,10 +527,6 @@ void onshutdown(void) {
     quit();
 }
 
-bool update_needed(void) {
-    return false;
-}
-
 static void oninput(Rune rune) {
     if (win_getregion() == EDIT && pty_active())
         pty_send_rune(rune);
@@ -603,7 +599,7 @@ int main(int argc, char** argv) {
     if (!ShellCmd[0]) ShellCmd[0] = "/bin/sh";
 
     /* create the window */
-    win_window("tide", ondiagmsg);
+    win_window("tide", false, ondiagmsg);
 
     /* open all but the last file in new instances */
     for (argc--, argv++; argc > 1; argc--, argv++) {