develop.uap-core.de/git
/
uwplayer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c4d69d0
)
support multiple uris in playlist dnd
author
Olaf Wintermann
<olaf.wintermann@gmail.com>
Mon, 5 Sep 2022 12:05:11 +0000
(14:05 +0200)
committer
Olaf Wintermann
<olaf.wintermann@gmail.com>
Mon, 5 Sep 2022 12:05:11 +0000
(14:05 +0200)
application/Sidebar.c
patch
|
blob
|
history
diff --git
a/application/Sidebar.c
b/application/Sidebar.c
index
3a2c29b
..
cf67fa0
100644
(file)
--- a/
application/Sidebar.c
+++ b/
application/Sidebar.c
@@
-31,6
+31,7
@@
#include "xdnd.h"
#include "utils.h"
#include "playlist.h"
#include "xdnd.h"
#include "utils.h"
#include "playlist.h"
+#include "ucx/string.h"
static void sidebar_class_init(void);
static void sidebar_class_init(void);
@@
-261,9
+262,10
@@
static void sidebar_expose(Widget widget, XEvent *event, Region region) {
int fontheight = xftFont->ascent;
int height = s->sidebar.elmHeight;
int fontheight = xftFont->ascent;
int height = s->sidebar.elmHeight;
+
int list_height = numTracks * height;
if((list_height > s->core.height) || (w < parent->core.width)) {
int list_height = numTracks * height;
if((list_height > s->core.height) || (w < parent->core.width)) {
- XtMakeResizeRequest(widget, parent->core.width, list_height, &w, &h);
+ XtMakeResizeRequest(widget, parent->core.width, list_height
+ 5
, &w, &h);
}
}
@@
-322,16
+324,9
@@
static void PopupAP(Widget w, XEvent *event, String *args, Cardinal *nArgs) {
}
}
-
-static void sidebar_xdnd_callback(Widget w, XtPointer udata, XtPointer cdata) {
- printf("xdnd\n");
- fflush(stdout);
-
- Sidebar s = (Sidebar)cdata;
-
- char *urilist = udata;
-
- size_t len = strlen(urilist);
+static void open_uri(Sidebar s, sstr_t uri) {
+ char *urilist = uri.ptr;
+ size_t len = uri.length;
size_t start = 0;
if(len > 7 && !memcmp(urilist, "file://", 7)) {
size_t start = 0;
if(len > 7 && !memcmp(urilist, "file://", 7)) {
@@
-377,11
+372,30
@@
static void sidebar_xdnd_callback(Widget w, XtPointer udata, XtPointer cdata) {
path[k] = '\0';
PlayListAddFile(s->sidebar.window, path);
path[k] = '\0';
PlayListAddFile(s->sidebar.window, path);
- SidebarRepaint((Widget)s);
free(path);
}
free(path);
}
+static void sidebar_xdnd_callback(Widget w, XtPointer udata, XtPointer cdata) {
+ printf("xdnd\n");
+ fflush(stdout);
+
+ Sidebar s = (Sidebar)cdata;
+
+ scstr_t urlist = scstr(udata);
+
+ ssize_t nuris;
+ sstr_t *uris = scstrsplit(urlist, scstr("\r\n"), &nuris);
+
+ for(int i=0;i<nuris;i++) {
+ if(uris[i].length > 0) {
+ open_uri(s, uris[i]);
+ }
+ }
+
+ SidebarRepaint((Widget)s);
+}
+
/* --------------------------- public --------------------------- */
/* --------------------------- public --------------------------- */