From 818ddb0a95216ddc78b3a4a893eb243b41759c10 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Sat, 18 Apr 2020 16:05:01 +0200
Subject: [PATCH] Delete not necessary code

---
 inc/lektor/module/module_sdl2.h |  3 +--
 inc/lektor/module/module_x11.h  |  3 +--
 inc/lektor/module/mpv.h         |  3 +--
 inc/lektor/window.h             |  4 ++--
 src/commands.c                  |  2 +-
 src/module/module_sdl2.c        | 18 ++----------------
 src/module/module_x11.c         | 17 ++---------------
 src/module/mpv.c                |  4 ++--
 8 files changed, 12 insertions(+), 42 deletions(-)

diff --git a/inc/lektor/module/module_sdl2.h b/inc/lektor/module/module_sdl2.h
index 18cdee5c..8caa155f 100644
--- a/inc/lektor/module/module_sdl2.h
+++ b/inc/lektor/module/module_sdl2.h
@@ -17,11 +17,10 @@ bool module_sdl2_new(struct lkt_win *const win);
 void module_sdl2_close(struct lkt_win *const win);
 void module_sdl2_free(struct lkt_win *const win);
 
-bool module_sdl2_toggle_pause(struct lkt_win *const win, bool *new_paused);
+bool module_sdl2_toggle_pause(struct lkt_win *const win);
 bool module_sdl2_load_file(struct lkt_win *const win, const char *filepath);
 bool module_sdl2_set_volume(struct lkt_win *const win, int vol);
 
-bool module_sdl2_is_paused(struct lkt_win *const win, bool *ret);
 bool module_sdl2_get_duration(struct lkt_win *const win, int *dur_sec);
 bool module_sdl2_get_elapsed(struct lkt_win *const win, int *elapsed_sec);
 
diff --git a/inc/lektor/module/module_x11.h b/inc/lektor/module/module_x11.h
index 5325fe48..29f943a9 100644
--- a/inc/lektor/module/module_x11.h
+++ b/inc/lektor/module/module_x11.h
@@ -17,11 +17,10 @@ bool module_x11_new(struct lkt_win *const win);
 void module_x11_close(struct lkt_win *const win);
 void module_x11_free(struct lkt_win *const win);
 
-bool module_x11_toggle_pause(struct lkt_win *const win, bool *new_paused);
+bool module_x11_toggle_pause(struct lkt_win *const win);
 bool module_x11_load_file(struct lkt_win *const win, const char *filepath);
 bool module_x11_set_volume(struct lkt_win *const win, int vol);
 
-bool module_x11_is_paused(struct lkt_win *const win, bool *ret);
 bool module_x11_get_duration(struct lkt_win *const win, int *dur_sec);
 bool module_x11_get_elapsed(struct lkt_win *const win, int *elapsed_sec);
 
diff --git a/inc/lektor/module/mpv.h b/inc/lektor/module/mpv.h
index d1414557..ce9c63e6 100644
--- a/inc/lektor/module/mpv.h
+++ b/inc/lektor/module/mpv.h
@@ -9,9 +9,8 @@ mpv_handle *lmpv_new(unsigned long int wid);
 int lmpv_observe_properties(mpv_handle *ctx);
 mpv_handle *lmpv_prepare(void);
 
-int lmpv_is_paused(mpv_handle *ctx, int *ret);
 int lmpv_set_volume(mpv_handle *ctx, int vol);
 int lmpv_load_file(mpv_handle *ctx, const char *file);
-int lmpv_toggle_pause(mpv_handle *ctx, int *pause);
+int lmpv_toggle_pause(mpv_handle *ctx);
 int lmpv_handle(struct lkt_win *win, mpv_handle *ctx, sqlite3 *db, enum mpd_idle_flag *mpd_idle_flag,
                 int *time_pos, int *time_duration);
diff --git a/inc/lektor/window.h b/inc/lektor/window.h
index f0f86b50..87644c98 100644
--- a/inc/lektor/window.h
+++ b/inc/lektor/window.h
@@ -20,12 +20,12 @@ struct lkt_win {
     void (*free)(struct lkt_win *win);  /* Entirelly liberate all the resources             */
 
     /* Playback control */
-    bool (*toggle_pause)(struct lkt_win *win, bool *new_paused);
+    bool (*toggle_pause)(struct lkt_win *win);
     bool (*load_file)(struct lkt_win *win, const char *filepath);
     bool (*set_volume)(struct lkt_win *win, int vol);
 
     /* Get playback properties */
-    bool (*is_paused)(struct lkt_win *win, bool *ret);
+    // bool (*is_paused)(struct lkt_win *win, bool *ret);
     bool (*get_duration)(struct lkt_win *win, int *dur_sec);
     bool (*get_elapsed)(struct lkt_win *win, int *elapsed_sec);
 
diff --git a/src/commands.c b/src/commands.c
index 1c525462..b95059d9 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -177,7 +177,7 @@ bool
 command_pause(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr)
 {
     *watch_mask_ptr |= MPD_IDLE_PLAYER;
-    return database_queue_toggle_pause(db) && win->toggle_pause(win, NULL);
+    return database_queue_toggle_pause(db) && win->toggle_pause(win);
 }
 
 bool
diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c
index c0195c9c..3f59fea4 100644
--- a/src/module/module_sdl2.c
+++ b/src/module/module_sdl2.c
@@ -69,7 +69,6 @@ module_set_function(void *arg__, void *handle__)
     win->toggle_pause = module_sdl2_toggle_pause;
     win->load_file = module_sdl2_load_file;
     win->set_volume = module_sdl2_set_volume;
-    win->is_paused = module_sdl2_is_paused;
     win->get_duration = module_sdl2_get_duration;
     win->get_elapsed = module_sdl2_get_elapsed;
     win->handle_events = module_sdl2_handle_events;
@@ -205,14 +204,11 @@ module_sdl2_free(struct lkt_win *const win)
 }
 
 bool
-module_sdl2_toggle_pause(struct lkt_win *const win, bool *new_paused)
+module_sdl2_toggle_pause(struct lkt_win *const win)
 {
     if (win == NULL || win->window == NULL)
         return false;
-    int pause, ret = ! lmpv_toggle_pause(((struct module_sdl2_window *) win->window)->mpv, &pause);
-    if (new_paused)
-        *new_paused = pause;
-    return ret;
+    return ! lmpv_toggle_pause(((struct module_sdl2_window *) win->window)->mpv);
 }
 
 bool
@@ -235,16 +231,6 @@ module_sdl2_set_volume(struct lkt_win *const win, int vol)
     return ! lmpv_set_volume(((struct module_sdl2_window *) win->window)->mpv, vol);
 }
 
-bool
-module_sdl2_is_paused(struct lkt_win *const win, bool *ret)
-{
-    if (win == NULL || win->window == NULL)
-        return false;
-    int ret_, sta = ! lmpv_is_paused(((struct module_sdl2_window *) win->window)->mpv, &ret_);
-    *ret = ret_;
-    return sta;
-}
-
 bool
 module_sdl2_get_duration(struct lkt_win *const win, int *dur_sec)
 {
diff --git a/src/module/module_x11.c b/src/module/module_x11.c
index cc800fd3..6d51472f 100644
--- a/src/module/module_x11.c
+++ b/src/module/module_x11.c
@@ -53,7 +53,6 @@ module_set_function(void *arg__, void *handle__)
     win->toggle_pause = module_x11_toggle_pause;
     win->load_file = module_x11_load_file;
     win->set_volume = module_x11_set_volume;
-    win->is_paused = module_x11_is_paused;
     win->get_duration = module_x11_get_duration;
     win->get_elapsed = module_x11_get_elapsed;
     win->handle_events = module_x11_handle_events;
@@ -286,13 +285,11 @@ module_x11_free(struct lkt_win *const win)
 }
 
 bool
-module_x11_toggle_pause(struct lkt_win *const win, bool *new_paused)
+module_x11_toggle_pause(struct lkt_win *const win)
 {
     if (win == NULL || win->window == NULL)
         return false;
-    int pause, ret = ! lmpv_toggle_pause(((struct module_x11_window *) win->window)->mpv, &pause);
-    *new_paused = pause;
-    return ret;
+    return ! lmpv_toggle_pause(((struct module_x11_window *) win->window)->mpv);
 }
 
 bool
@@ -315,16 +312,6 @@ module_x11_set_volume(struct lkt_win *const win, int vol)
     return ! lmpv_set_volume(((struct module_x11_window *) win->window)->mpv, vol);
 }
 
-bool
-module_x11_is_paused(struct lkt_win *const win, bool *ret)
-{
-    if (win == NULL || win->window == NULL)
-        return false;
-    int ret_, sta = ! lmpv_is_paused(((struct module_x11_window *) win->window)->mpv, &ret_);
-    *ret = ret_;
-    return sta;
-}
-
 bool
 module_x11_get_duration(struct lkt_win *const win, int *dur_sec)
 {
diff --git a/src/module/mpv.c b/src/module/mpv.c
index 31cad22a..74674109 100644
--- a/src/module/mpv.c
+++ b/src/module/mpv.c
@@ -182,7 +182,7 @@ lmpv_load_file(mpv_handle *ctx, const char *file)
 }
 
 int
-lmpv_toggle_pause(mpv_handle *ctx, int *pause)
+lmpv_toggle_pause(mpv_handle *ctx)
 {
     if (!ctx) {
         fprintf(stderr, " ! lmpv_toggle_pause: failed due to missing mpv ctx\n");
@@ -197,7 +197,7 @@ lmpv_toggle_pause(mpv_handle *ctx, int *pause)
                 mpv_error_string(status));
         return 1;
     }
-    return lmpv_is_paused(ctx, pause);
+    return 0;
 }
 
 int
-- 
GitLab