[Mplayerplug-in-cvs] mplayerplug-in/Source mplayerplug-in.c,1.148,1.149 mplayerplug-in.h,1.38,1.39 u
Brought to you by:
kdekorte
From: <kde...@us...> - 2004-01-22 01:55:03
|
Update of /cvsroot/mplayerplug-in/mplayerplug-in/Source In directory sc8-pr-cvs1:/tmp/cvs-serv12261/Source Modified Files: mplayerplug-in.c mplayerplug-in.h ui.c Log Message: UI Changes Index: mplayerplug-in.c =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/mplayerplug-in.c,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** mplayerplug-in.c 21 Jan 2004 21:21:29 -0000 1.148 --- mplayerplug-in.c 22 Jan 2004 01:55:00 -0000 1.149 *************** *** 1174,1178 **** This->td->instance = NULL; pthread_mutex_unlock(&(This->playlist_mutex)); ! } else { if (DEBUG) --- 1174,1179 ---- This->td->instance = NULL; pthread_mutex_unlock(&(This->playlist_mutex)); ! // Free any UI data necessary ! FreeUI((Display *) This->display); } else { if (DEBUG) Index: mplayerplug-in.h =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/mplayerplug-in.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** mplayerplug-in.h 21 Jan 2004 21:21:29 -0000 1.38 --- mplayerplug-in.h 22 Jan 2004 01:55:00 -0000 1.39 *************** *** 153,156 **** --- 153,157 ---- extern void LoadConfigFile(NPP instance); extern void InitPrivateData(NPP instance); + extern void FreeUI(Display * dpy); extern void DrawUI(Widget w, NPP instance, char *message, int FullRedraw, int percent); Index: ui.c =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/ui.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ui.c 21 Jan 2004 21:21:29 -0000 1.36 --- ui.c 22 Jan 2004 01:55:00 -0000 1.37 *************** *** 16,19 **** --- 16,20 ---- #include "progress_middle.xpm" #include "progress_right.xpm" + #include "progress_fill.xpm" #define BORDER 10 *************** *** 30,42 **** --- 31,51 ---- static Pixmap progress_middle, progress_middlemask; static Pixmap progress_right, progress_rightmask; + static Pixmap progress_fill, progress_fillmask; static int lastpercent = -1; void Initialize(Display * dpy, Drawable d, GC gc) { + Cursor guicursor; + XSetWindowAttributes attrs; + XpmCreatePixmapFromData(dpy, d, logo_xpm, &logo, &logomask, NULL); XpmCreatePixmapFromData(dpy, d, progress_left_xpm, &progress_left, &progress_leftmask, NULL); XpmCreatePixmapFromData(dpy, d, progress_middle_xpm, &progress_middle, &progress_middlemask, NULL); XpmCreatePixmapFromData(dpy, d, progress_right_xpm, &progress_right, &progress_rightmask, NULL); + XpmCreatePixmapFromData(dpy, d, progress_fill_xpm, &progress_fill, &progress_fillmask, NULL); font = XQueryFont(dpy, XGContextFromGC(gc)); + guicursor = XCreateFontCursor(dpy, XC_watch); + attrs.cursor = guicursor; + XChangeWindowAttributes(dpy, d, CWCursor, &attrs); } *************** *** 76,81 **** &values); ! for(i=0;i<width;i++) ! XCopyArea(dpy, progress_middle, (Drawable) w, border_gc, 0, 0, 1, 31, x + i, y - 10); values.clip_mask = progress_rightmask; --- 85,93 ---- &values); ! XSetTile(dpy, border_gc, progress_middle); ! XSetFillStyle(dpy, border_gc, FillTiled); ! XSetTSOrigin(dpy, border_gc, x, y - 10); ! XFillRectangle(dpy, w, border_gc, x, y - 10, width, 31); ! XSetFillStyle(dpy, border_gc, FillSolid); values.clip_mask = progress_rightmask; *************** *** 95,114 **** int height, int percent) { - XGCValues values; GC progress_gc; int pixelpercent, ret; ! XColor Xcolor; if (percent > 100) percent = 100; - ret = XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), "blue", - &Xcolor); - if (ret == 0) return; - ret = XAllocColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), &Xcolor); - if (ret == 0) return; - values.foreground = Xcolor.pixel; progress_gc = XCreateGC(dpy, w, GCForeground, &values); pixelpercent = (width - x) * (percent / 100.); XFillRectangle(dpy, w, progress_gc, x, y, pixelpercent, height); XFreeGC(dpy, progress_gc); } --- 107,123 ---- int height, int percent) { GC progress_gc; int pixelpercent, ret; ! XGCValues values; if (percent > 100) percent = 100; progress_gc = XCreateGC(dpy, w, GCForeground, &values); + XSetTile(dpy, progress_gc, progress_fill); + XSetFillStyle(dpy, progress_gc, FillTiled); + XSetTSOrigin(dpy, progress_gc, x, y); pixelpercent = (width - x) * (percent / 100.); XFillRectangle(dpy, w, progress_gc, x, y, pixelpercent, height); + XSetFillStyle(dpy, progress_gc, FillSolid); XFreeGC(dpy, progress_gc); } *************** *** 128,133 **** int term, chop; int PercentRedraw; - Cursor guicursor; - XSetWindowAttributes attrs; This = (PluginInstance *) instance->pdata; --- 137,140 ---- *************** *** 169,177 **** FullRedraw = TRUE; Initialize((Display *) This->display, This->window, black_gc); - guicursor = XCreateFontCursor((Display *) This->display, XC_watch); - //XDefineCursor((Display *) This->display, This->window, guicursor); - attrs.cursor = guicursor; - XChangeWindowAttributes((Display *) This->display, This->window, - CWCursor, &attrs); } font_height = font->max_bounds.ascent + font->max_bounds.descent; --- 176,179 ---- *************** *** 245,246 **** --- 247,263 ---- usleep(100); } + + void FreeUI(Display * dpy) + { + font = NULL; + // Free all the pixmaps used by the GUI + if (progress_left) XFreePixmap(dpy, progress_left); + if (progress_leftmask) XFreePixmap(dpy, progress_leftmask); + if (progress_middle) XFreePixmap(dpy, progress_middle); + if (progress_middlemask) XFreePixmap(dpy, progress_middlemask); + if (progress_right) XFreePixmap(dpy, progress_right); + if (progress_rightmask) XFreePixmap(dpy, progress_rightmask); + if (progress_fill) XFreePixmap(dpy, progress_fill); + if (progress_fillmask) XFreePixmap(dpy, progress_fillmask); + // Don't free the font since we didn't create it + } |