X-Git-Url: https://develop.uap-core.de/gitweb/uwplayer.git/blobdiff_plain/3c1675731caaac73d6c362075ffb82bc45d2f060..c4d69d05f758eb2f8f98be04ff42456c9ae711fe:/application/Sidebar.c diff --git a/application/Sidebar.c b/application/Sidebar.c index 4faff71..3a2c29b 100644 --- a/application/Sidebar.c +++ b/application/Sidebar.c @@ -192,8 +192,18 @@ static void sidebar_destroy(Widget widget) { } +static int testresize = 1; static void sidebar_resize(Widget widget) { - + if(testresize) { + XtWidgetGeometry geom; + geom.request_mode = CWWidth | CWHeight; + geom.width = 200; + geom.height = 2000; + XtWidgetGeometry result; + //XtMakeGeometryRequest(widget, &geom, &result); + testresize = 0; + } + printf("resize\n"); } static int xdnd_initialized = 0; @@ -222,22 +232,44 @@ static void sidebar_realize(Widget widget, XtValueMask *mask, XSetWindowAttribut XtWindow(widget), visual, widget->core.colormap); + + Dimension w, h; + + Widget parent = XtParent(widget); + XtVaSetValues(parent, XmNbackground, WhitePixelOfScreen(XtScreen(parent)), NULL); + + XtMakeResizeRequest(widget, 200, 100, &w, &h); + + } static void sidebar_expose(Widget widget, XEvent *event, Region region) { //printf("expose\n"); Dimension w, h; - XtMakeResizeRequest(widget, 200, 200, &w, &h); + //XtMakeResizeRequest(widget, 200, 2000, &w, &h); - Sidebar s = (Sidebar)widget; - XftFont *xftFont = s->sidebar.font->fonts->font; + w = widget->core.width; + h = widget->core.height; + Widget parent = XtParent(widget); - XftDrawRect(s->sidebar.d, &s->sidebar.bg, 0, 0, s->core.width, s->core.height); + Sidebar s = (Sidebar)widget; + XftFont *xftFont = s->sidebar.font->fonts->font; + UcxList *tracks = s->sidebar.window->playlist.tracks; + size_t numTracks = ucx_list_size(tracks); int fontheight = xftFont->ascent; int height = s->sidebar.elmHeight; + int list_height = numTracks * height; + if((list_height > s->core.height) || (w < parent->core.width)) { + XtMakeResizeRequest(widget, parent->core.width, list_height, &w, &h); + } + + + XftDrawRect(s->sidebar.d, &s->sidebar.bg, 0, 0, w, h); + + //printf("current track: %d\n", s->sidebar.window->playlist.current_track); int i = 0; @@ -345,6 +377,7 @@ static void sidebar_xdnd_callback(Widget w, XtPointer udata, XtPointer cdata) { path[k] = '\0'; PlayListAddFile(s->sidebar.window, path); + SidebarRepaint((Widget)s); free(path); }