mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
show workspace name when changing workspace
This commit is contained in:
@@ -23,6 +23,7 @@ Changes since version 0.52.0:
|
|||||||
- added a crashing dialog panel to select what to do on crashes.
|
- added a crashing dialog panel to select what to do on crashes.
|
||||||
- fixed the problem with showing a window as focused in the window list menu
|
- fixed the problem with showing a window as focused in the window list menu
|
||||||
while it was on another workspace.
|
while it was on another workspace.
|
||||||
|
- show workspace name on screen when switching workspaces
|
||||||
|
|
||||||
|
|
||||||
Changes since version 0.51.2:
|
Changes since version 0.51.2:
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ before compiling.
|
|||||||
|
|
||||||
Also, do not disable mwm hints support (they are enabled by default).
|
Also, do not disable mwm hints support (they are enabled by default).
|
||||||
|
|
||||||
I am not sure, but using --enable-lite or DisableWSMouseActions=YES;
|
|
||||||
might be a bad idea in case of GNOME.
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
|
In WPrefs, go to the last section and toggle the "Disable miniwindows" option.
|
||||||
|
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ static void
|
|||||||
handleActionEvents(XEvent *event, void *data)
|
handleActionEvents(XEvent *event, void *data)
|
||||||
{
|
{
|
||||||
WMSlider *sPtr = (Slider*)data;
|
WMSlider *sPtr = (Slider*)data;
|
||||||
|
int ovalue = sPtr->value;
|
||||||
|
|
||||||
CHECK_CLASS(data, WC_Slider);
|
CHECK_CLASS(data, WC_Slider);
|
||||||
|
|
||||||
@@ -511,7 +512,7 @@ handleActionEvents(XEvent *event, void *data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if (!sPtr->flags.continuous && sPtr->flags.dragging && sPtr->action) {
|
if (!sPtr->flags.continuous && ovalue != sPtr->value && sPtr->action) {
|
||||||
(*sPtr->action)(sPtr, sPtr->clientData);
|
(*sPtr->action)(sPtr, sPtr->clientData);
|
||||||
}
|
}
|
||||||
sPtr->flags.dragging = 0;
|
sPtr->flags.dragging = 0;
|
||||||
|
|||||||
@@ -956,8 +956,7 @@ changePage(WMWidget *w, void *data)
|
|||||||
|
|
||||||
WMSelectListItem(panel->texLs, panel->textureIndex[section]);
|
WMSelectListItem(panel->texLs, panel->textureIndex[section]);
|
||||||
|
|
||||||
WMSetListPosition(panel->texLs, panel->textureIndex[section]
|
WMSetListPosition(panel->texLs, panel->textureIndex[section] - 2);
|
||||||
- WMGetListNumberOfRows(panel->texLs)/2);
|
|
||||||
|
|
||||||
item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
|
item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/* MouseSettings.c- mouse options (some are equivalent to xset)
|
/* MouseSettings.c- mouse options (some are equivalent to xset)
|
||||||
*
|
*
|
||||||
* WPrefs - Window Maker Preferences Program
|
* WPrefs - Window Maker Preferences Program
|
||||||
@@ -47,7 +48,7 @@ typedef struct _Panel {
|
|||||||
|
|
||||||
WMFrame *speedF;
|
WMFrame *speedF;
|
||||||
WMLabel *speedL;
|
WMLabel *speedL;
|
||||||
WMButton *speedB[5];
|
WMSlider *speedS;
|
||||||
WMLabel *acceL;
|
WMLabel *acceL;
|
||||||
WMTextField *acceT;
|
WMTextField *acceT;
|
||||||
WMLabel *threL;
|
WMLabel *threL;
|
||||||
@@ -77,7 +78,6 @@ typedef struct _Panel {
|
|||||||
WMPopUpButton *grabP;
|
WMPopUpButton *grabP;
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
WMButton *lastClickedSpeed;
|
|
||||||
int maxThreshold;
|
int maxThreshold;
|
||||||
float acceleration;
|
float acceleration;
|
||||||
} _Panel;
|
} _Panel;
|
||||||
@@ -86,8 +86,6 @@ typedef struct _Panel {
|
|||||||
#define ICON_FILE "mousesettings"
|
#define ICON_FILE "mousesettings"
|
||||||
|
|
||||||
#define SPEED_ICON_FILE "mousespeed"
|
#define SPEED_ICON_FILE "mousespeed"
|
||||||
#define SPEED_IMAGE "speed%i"
|
|
||||||
#define SPEED_IMAGE_S "speed%is"
|
|
||||||
|
|
||||||
#define DELAY_ICON "timer%i"
|
#define DELAY_ICON "timer%i"
|
||||||
#define DELAY_ICON_S "timer%is"
|
#define DELAY_ICON_S "timer%is"
|
||||||
@@ -132,7 +130,7 @@ setMouseAccel(WMScreen *scr, float accel, int threshold)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
speedClick(WMWidget *w, void *data)
|
speedChange(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
int i;
|
int i;
|
||||||
@@ -155,14 +153,11 @@ speedClick(WMWidget *w, void *data)
|
|||||||
panel->acceleration = accel;
|
panel->acceleration = accel;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else {
|
} else {
|
||||||
for (i=0; i<5; i++) {
|
i = (int)WMGetSliderValue(panel->speedS);
|
||||||
if (panel->speedB[i]==w)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
panel->acceleration = 0.5+(i*0.5);
|
panel->acceleration = 0.25+(i*0.25);
|
||||||
|
|
||||||
sprintf(buffer, "%.2f", 0.5+(i*0.5));
|
sprintf(buffer, "%.2f", 0.25+(i*0.25));
|
||||||
WMSetTextFieldText(panel->acceT, buffer);
|
WMSetTextFieldText(panel->acceT, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +180,7 @@ returnPressed(void *observerData, WMNotification *notification)
|
|||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)observerData;
|
_Panel *panel = (_Panel*)observerData;
|
||||||
|
|
||||||
speedClick(NULL, panel);
|
speedChange(NULL, panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -310,20 +305,12 @@ showData(_Panel *panel)
|
|||||||
sprintf(buffer, "%i", a);
|
sprintf(buffer, "%i", a);
|
||||||
WMSetTextFieldText(panel->threT, buffer);
|
WMSetTextFieldText(panel->threT, buffer);
|
||||||
|
|
||||||
a = -1;
|
WMSetSliderValue(panel->speedS, (accel - 0.25)/0.25);
|
||||||
for (i=0; i<5; i++) {
|
|
||||||
if (0.5+(float)i*0.5 == accel)
|
|
||||||
a = i;
|
|
||||||
}
|
|
||||||
if (a >= 0) {
|
|
||||||
WMPerformButtonClick(panel->speedB[a]);
|
|
||||||
panel->lastClickedSpeed = panel->speedB[a];
|
|
||||||
}
|
|
||||||
panel->acceleration = accel;
|
panel->acceleration = accel;
|
||||||
sprintf(buffer, "%.2f", accel);
|
sprintf(buffer, "%.2f", accel);
|
||||||
WMSetTextFieldText(panel->acceT, buffer);
|
WMSetTextFieldText(panel->acceT, buffer);
|
||||||
|
|
||||||
speedClick(panel->lastClickedSpeed, panel);
|
|
||||||
/**/
|
/**/
|
||||||
b = GetIntegerForKey("DoubleClickTime");
|
b = GetIntegerForKey("DoubleClickTime");
|
||||||
/* find best match */
|
/* find best match */
|
||||||
@@ -549,47 +536,14 @@ createPanel(Panel *p)
|
|||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf1 = wmalloc(strlen(SPEED_IMAGE)+2);
|
panel->speedS = WMCreateSlider(panel->speedF);
|
||||||
buf2 = wmalloc(strlen(SPEED_IMAGE_S)+2);
|
WMResizeWidget(panel->speedS, 160, 15);
|
||||||
|
WMMoveWidget(panel->speedS, 70, 35);
|
||||||
|
WMSetSliderMinValue(panel->speedS, 0);
|
||||||
|
WMSetSliderMaxValue(panel->speedS, 40);
|
||||||
|
WMSetSliderContinuous(panel->speedS, False);
|
||||||
|
WMSetSliderAction(panel->speedS, speedChange, panel);
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
|
||||||
panel->speedB[i] = WMCreateCustomButton(panel->speedF,
|
|
||||||
WBBStateChangeMask);
|
|
||||||
WMResizeWidget(panel->speedB[i], 26, 26);
|
|
||||||
WMMoveWidget(panel->speedB[i], 60+(35*i), 25);
|
|
||||||
WMSetButtonBordered(panel->speedB[i], False);
|
|
||||||
WMSetButtonImagePosition(panel->speedB[i], WIPImageOnly);
|
|
||||||
WMSetButtonAction(panel->speedB[i], speedClick, panel);
|
|
||||||
if (i > 0) {
|
|
||||||
WMGroupButtons(panel->speedB[0], panel->speedB[i]);
|
|
||||||
}
|
|
||||||
sprintf(buf1, SPEED_IMAGE, i);
|
|
||||||
sprintf(buf2, SPEED_IMAGE_S, i);
|
|
||||||
path = LocateImage(buf1);
|
|
||||||
if (path) {
|
|
||||||
icon = WMCreatePixmapFromFile(scr, path);
|
|
||||||
if (icon) {
|
|
||||||
WMSetButtonImage(panel->speedB[i], icon);
|
|
||||||
WMReleasePixmap(icon);
|
|
||||||
} else {
|
|
||||||
wwarning(_("could not load icon file %s"), path);
|
|
||||||
}
|
|
||||||
free(path);
|
|
||||||
}
|
|
||||||
path = LocateImage(buf2);
|
|
||||||
if (path) {
|
|
||||||
icon = WMCreatePixmapFromFile(scr, path);
|
|
||||||
if (icon) {
|
|
||||||
WMSetButtonAltImage(panel->speedB[i], icon);
|
|
||||||
WMReleasePixmap(icon);
|
|
||||||
} else {
|
|
||||||
wwarning(_("could not load icon file %s"), path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(buf1);
|
|
||||||
free(buf2);
|
|
||||||
|
|
||||||
panel->acceL = WMCreateLabel(panel->speedF);
|
panel->acceL = WMCreateLabel(panel->speedF);
|
||||||
WMResizeWidget(panel->acceL, 70, 16);
|
WMResizeWidget(panel->acceL, 70, 16);
|
||||||
WMMoveWidget(panel->acceL, 10, 67);
|
WMMoveWidget(panel->acceL, 10, 67);
|
||||||
|
|||||||
@@ -676,10 +676,8 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* REDUCE_APPICONS */
|
#endif /* REDUCE_APPICONS */
|
||||||
#if 0
|
|
||||||
/* aproveita que ta aqui pra atualizar */
|
printf("%i\n",wapp->refcount);
|
||||||
wapp->main_window = aicon->icon->owner->main_window;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unhideHere = (event->xbutton.state & ShiftMask);
|
unhideHere = (event->xbutton.state & ShiftMask);
|
||||||
|
|
||||||
|
|||||||
@@ -184,10 +184,13 @@ Restart(char *manager)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (dpy) {
|
||||||
#ifdef XSMP_ENABLED
|
#ifdef XSMP_ENABLED
|
||||||
wSessionDisconnectManager();
|
wSessionDisconnectManager();
|
||||||
#endif
|
#endif
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
|
dpy = NULL;
|
||||||
|
}
|
||||||
if (!prog)
|
if (!prog)
|
||||||
execvp(Arguments[0], Arguments);
|
execvp(Arguments[0], Arguments);
|
||||||
else {
|
else {
|
||||||
|
|||||||
26
src/screen.c
26
src/screen.c
@@ -155,7 +155,6 @@ alreadyRunningError(Display *dpy, XErrorEvent *error)
|
|||||||
* not be freed by anybody.
|
* not be freed by anybody.
|
||||||
*----------------------------------------------------------------------
|
*----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifndef NEWSTUFF
|
|
||||||
static void
|
static void
|
||||||
allocButtonPixmaps(WScreen *scr)
|
allocButtonPixmaps(WScreen *scr)
|
||||||
{
|
{
|
||||||
@@ -182,8 +181,6 @@ allocButtonPixmaps(WScreen *scr)
|
|||||||
pix->shared = 1;
|
pix->shared = 1;
|
||||||
scr->b_pixmaps[WBUT_KILL] = pix;
|
scr->b_pixmaps[WBUT_KILL] = pix;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -366,7 +363,13 @@ allocGCs(WScreen *scr)
|
|||||||
/* misc drawing GC */
|
/* misc drawing GC */
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
gcm = GCGraphicsExposures;
|
gcm = GCGraphicsExposures;
|
||||||
scr->draw_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
|
scr->draw_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
|
||||||
|
|
||||||
|
assert (scr->stipple_bitmap!=None);
|
||||||
|
|
||||||
|
|
||||||
|
/* mono GC */
|
||||||
|
scr->mono_gc = XCreateGC(dpy, scr->stipple_bitmap, gcm, &gcv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -538,6 +541,19 @@ createInternalWindows(WScreen *scr)
|
|||||||
CopyFromParent, scr->w_visual, vmask, &attribs);
|
CopyFromParent, scr->w_visual, vmask, &attribs);
|
||||||
|
|
||||||
|
|
||||||
|
/* workspace name */
|
||||||
|
vmask = CWBackPixel|CWSaveUnder|CWOverrideRedirect|CWColormap
|
||||||
|
|CWBorderPixel;
|
||||||
|
attribs.save_under = True;
|
||||||
|
attribs.override_redirect = True;
|
||||||
|
attribs.colormap = scr->w_colormap;
|
||||||
|
attribs.background_pixel = scr->icon_back_texture->normal.pixel;
|
||||||
|
attribs.border_pixel = 0; /* do not care */
|
||||||
|
scr->workspace_name =
|
||||||
|
XCreateWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, scr->w_depth,
|
||||||
|
CopyFromParent, scr->w_visual, vmask, &attribs);
|
||||||
|
|
||||||
|
|
||||||
/* for our window manager info notice board */
|
/* for our window manager info notice board */
|
||||||
scr->info_window =
|
scr->info_window =
|
||||||
XCreateWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, CopyFromParent,
|
XCreateWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, CopyFromParent,
|
||||||
@@ -758,6 +774,8 @@ wScreenInit(int screen_number)
|
|||||||
scr->frame_border_pixel = xcol.pixel;
|
scr->frame_border_pixel = xcol.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scr->workspace_name_font = wLoadFont(DEF_WORKSPACE_NAME_FONT);
|
||||||
|
|
||||||
/* create GCs with default values */
|
/* create GCs with default values */
|
||||||
allocGCs(scr);
|
allocGCs(scr);
|
||||||
|
|
||||||
|
|||||||
13
src/screen.h
13
src/screen.h
@@ -152,6 +152,7 @@ typedef struct _WScreen {
|
|||||||
WFont *clip_title_font; /* for clip titles */
|
WFont *clip_title_font; /* for clip titles */
|
||||||
WFont *info_text_font; /* text on things like geometry
|
WFont *info_text_font; /* text on things like geometry
|
||||||
* hint boxes */
|
* hint boxes */
|
||||||
|
WFont *workspace_name_font;
|
||||||
|
|
||||||
WMPixel select_pixel;
|
WMPixel select_pixel;
|
||||||
WMPixel select_text_pixel;
|
WMPixel select_text_pixel;
|
||||||
@@ -192,13 +193,16 @@ typedef struct _WScreen {
|
|||||||
GC select_menu_gc; /* selected menu entries */
|
GC select_menu_gc; /* selected menu entries */
|
||||||
GC disabled_menu_entry_gc; /* disabled menu entries */
|
GC disabled_menu_entry_gc; /* disabled menu entries */
|
||||||
GC info_text_gc; /* for size/position display */
|
GC info_text_gc; /* for size/position display */
|
||||||
|
GC icon_select_gc;
|
||||||
|
GC workspace_name_gc; /* for the name shown when workspace
|
||||||
|
* is changed */
|
||||||
|
|
||||||
GC frame_gc; /* gc for resize/move frame (root) */
|
GC frame_gc; /* gc for resize/move frame (root) */
|
||||||
GC line_gc; /* gc for drawing XORed lines (root) */
|
GC line_gc; /* gc for drawing XORed lines (root) */
|
||||||
GC copy_gc; /* gc for XCopyArea() */
|
GC copy_gc; /* gc for XCopyArea() */
|
||||||
GC stipple_gc; /* gc for stippled filling */
|
GC stipple_gc; /* gc for stippled filling */
|
||||||
GC icon_select_gc;
|
|
||||||
GC draw_gc; /* gc for drawing misc things */
|
GC draw_gc; /* gc for drawing misc things */
|
||||||
|
GC mono_gc; /* gc for 1 bit drawables */
|
||||||
|
|
||||||
#ifndef NEWSTUFF
|
#ifndef NEWSTUFF
|
||||||
struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
|
struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
|
||||||
@@ -270,7 +274,12 @@ typedef struct _WScreen {
|
|||||||
|
|
||||||
/* balloon help data */
|
/* balloon help data */
|
||||||
struct _WBalloon *balloon;
|
struct _WBalloon *balloon;
|
||||||
|
|
||||||
|
/* workspace name data */
|
||||||
|
Window workspace_name;
|
||||||
|
WMHandlerID *workspace_name_timer;
|
||||||
|
struct WorkspaceNameData *workspace_name_data;
|
||||||
|
|
||||||
/* for raise-delay */
|
/* for raise-delay */
|
||||||
WMHandlerID *autoRaiseTimer;
|
WMHandlerID *autoRaiseTimer;
|
||||||
Window autoRaiseWindow; /* window that is scheduled to be
|
Window autoRaiseWindow; /* window that is scheduled to be
|
||||||
|
|||||||
@@ -565,3 +565,4 @@ InitGhostWindowMove(WScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GHOST_WINDOW_MOVE */
|
#endif /* GHOST_WINDOW_MOVE */
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notifyClient(WMenu *menu, WMenuEntry *entry){
|
notifyClient(WMenu *menu, WMenuEntry *entry)
|
||||||
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
WUserMenuData *data = entry->clientdata;
|
WUserMenuData *data = entry->clientdata;
|
||||||
WScreen *scr = data->screen;
|
WScreen *scr = data->screen;
|
||||||
@@ -78,7 +79,7 @@ notifyClient(WMenu *menu, WMenuEntry *entry){
|
|||||||
|
|
||||||
window=scr->focused_window->client_win;
|
window=scr->focused_window->client_win;
|
||||||
|
|
||||||
for(i=0;i<data->key_no;i++){
|
for(i=0;i<data->key_no;i++) {
|
||||||
event.xkey.type = KeyPress;
|
event.xkey.type = KeyPress;
|
||||||
event.xkey.display = dpy;
|
event.xkey.display = dpy;
|
||||||
event.xkey.window = window;
|
event.xkey.window = window;
|
||||||
@@ -99,7 +100,8 @@ notifyClient(WMenu *menu, WMenuEntry *entry){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
removeUserMenudata(void *menudata){
|
removeUserMenudata(void *menudata)
|
||||||
|
{
|
||||||
WUserMenuData *data = menudata;
|
WUserMenuData *data = menudata;
|
||||||
if(data->key) free(data->key);
|
if(data->key) free(data->key);
|
||||||
free(data);
|
free(data);
|
||||||
@@ -107,7 +109,8 @@ removeUserMenudata(void *menudata){
|
|||||||
|
|
||||||
|
|
||||||
static WUserMenuData*
|
static WUserMenuData*
|
||||||
convertShortcuts(WScreen *scr, proplist_t shortcut){
|
convertShortcuts(WScreen *scr, proplist_t shortcut)
|
||||||
|
{
|
||||||
WUserMenuData *data;
|
WUserMenuData *data;
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
char *k;
|
char *k;
|
||||||
@@ -115,10 +118,10 @@ convertShortcuts(WScreen *scr, proplist_t shortcut){
|
|||||||
char buf[128], *b;
|
char buf[128], *b;
|
||||||
int keycount,i,j,mod;
|
int keycount,i,j,mod;
|
||||||
|
|
||||||
if (PLIsString(shortcut)){
|
if (PLIsString(shortcut)) {
|
||||||
keycount = 1;
|
keycount = 1;
|
||||||
}
|
}
|
||||||
else if (PLIsArray(shortcut)){
|
else if (PLIsArray(shortcut)) {
|
||||||
keycount = PLGetNumberOfElements(shortcut);
|
keycount = PLGetNumberOfElements(shortcut);
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
@@ -137,8 +140,7 @@ convertShortcuts(WScreen *scr, proplist_t shortcut){
|
|||||||
data->key[j].modifier = 0;
|
data->key[j].modifier = 0;
|
||||||
if (PLIsArray(shortcut)) {
|
if (PLIsArray(shortcut)) {
|
||||||
strcpy(buf, PLGetString(PLGetArrayElement(shortcut, i)));
|
strcpy(buf, PLGetString(PLGetArrayElement(shortcut, i)));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
strcpy(buf, PLGetString(shortcut));
|
strcpy(buf, PLGetString(shortcut));
|
||||||
}
|
}
|
||||||
b = (char*)buf;
|
b = (char*)buf;
|
||||||
@@ -180,7 +182,8 @@ keyover:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static WMenu*
|
static WMenu*
|
||||||
configureUserMenu(WScreen *scr, proplist_t plum){
|
configureUserMenu(WScreen *scr, proplist_t plum)
|
||||||
|
{
|
||||||
char *mtitle;
|
char *mtitle;
|
||||||
WMenu *menu=NULL;
|
WMenu *menu=NULL;
|
||||||
proplist_t elem, title, command, params;
|
proplist_t elem, title, command, params;
|
||||||
@@ -188,7 +191,7 @@ configureUserMenu(WScreen *scr, proplist_t plum){
|
|||||||
WUserMenuData *data;
|
WUserMenuData *data;
|
||||||
|
|
||||||
if (!plum) return NULL;
|
if (!plum) return NULL;
|
||||||
if (!PLIsArray(plum)){
|
if (!PLIsArray(plum)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +199,7 @@ configureUserMenu(WScreen *scr, proplist_t plum){
|
|||||||
if (!count) return NULL;
|
if (!count) return NULL;
|
||||||
|
|
||||||
elem = PLGetArrayElement(plum, 0);
|
elem = PLGetArrayElement(plum, 0);
|
||||||
if (!PLIsString(elem)){
|
if (!PLIsString(elem)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,9 +207,9 @@ configureUserMenu(WScreen *scr, proplist_t plum){
|
|||||||
|
|
||||||
menu=wMenuCreateForApp(scr, mtitle, True);
|
menu=wMenuCreateForApp(scr, mtitle, True);
|
||||||
|
|
||||||
for(i=1; i<count; i++){
|
for(i=1; i<count; i++) {
|
||||||
elem = PLGetArrayElement(plum,i);
|
elem = PLGetArrayElement(plum,i);
|
||||||
if(PLIsArray(PLGetArrayElement(elem,1))){
|
if(PLIsArray(PLGetArrayElement(elem,1))) {
|
||||||
WMenu *submenu;
|
WMenu *submenu;
|
||||||
WMenuEntry *mentry;
|
WMenuEntry *mentry;
|
||||||
|
|
||||||
@@ -228,7 +231,7 @@ configureUserMenu(WScreen *scr, proplist_t plum){
|
|||||||
if (!title || !command)
|
if (!title || !command)
|
||||||
return menu;
|
return menu;
|
||||||
|
|
||||||
if (!strcmp("SHORTCUT",PLGetString(command))){
|
if (!strcmp("SHORTCUT",PLGetString(command))) {
|
||||||
WMenuEntry *entry;
|
WMenuEntry *entry;
|
||||||
|
|
||||||
data = convertShortcuts(scr, params);
|
data = convertShortcuts(scr, params);
|
||||||
@@ -242,12 +245,12 @@ configureUserMenu(WScreen *scr, proplist_t plum){
|
|||||||
}
|
}
|
||||||
entry->free_cdata = removeUserMenudata;
|
entry->free_cdata = removeUserMenudata;
|
||||||
|
|
||||||
if (PLGetNumberOfElements(elem) >= 4){
|
if (PLGetNumberOfElements(elem) >= 4) {
|
||||||
instances = PLGetArrayElement(elem,idx++);
|
instances = PLGetArrayElement(elem,idx++);
|
||||||
if(PLIsArray(instances))
|
if(PLIsArray(instances))
|
||||||
if (instances && PLGetNumberOfElements(instances)
|
if (instances && PLGetNumberOfElements(instances)
|
||||||
&& PLIsArray(instances)){
|
&& PLIsArray(instances)){
|
||||||
entry->instances = PLRetain(instances);
|
entry->instances = PLRetain(instances);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,9 +281,9 @@ wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
|
|||||||
|
|
||||||
oldflag = menu->entries[i]->flags.enabled;
|
oldflag = menu->entries[i]->flags.enabled;
|
||||||
menu->entries[i]->flags.enabled = 0;
|
menu->entries[i]->flags.enabled = 0;
|
||||||
for (j=0; j<count;j++){
|
for (j=0; j<count;j++) {
|
||||||
ins = PLGetArrayElement(menu->entries[i]->instances,j);
|
ins = PLGetArrayElement(menu->entries[i]->instances,j);
|
||||||
if (!strcmp(wwin->wm_instance,PLGetString(ins))){
|
if (!strcmp(wwin->wm_instance,PLGetString(ins))) {
|
||||||
menu->entries[i]->flags.enabled = 1;
|
menu->entries[i]->flags.enabled = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -291,12 +294,12 @@ wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
|
|||||||
}
|
}
|
||||||
for (i=0; i < menu->cascade_no; i++) {
|
for (i=0; i < menu->cascade_no; i++) {
|
||||||
if (!menu->cascades[i]->flags.brother)
|
if (!menu->cascades[i]->flags.brother)
|
||||||
wUserMenuRefreshInstances(menu->cascades[i], wwin);
|
wUserMenuRefreshInstances(menu->cascades[i], wwin);
|
||||||
else
|
else
|
||||||
wUserMenuRefreshInstances(menu->cascades[i]->brother, wwin);
|
wUserMenuRefreshInstances(menu->cascades[i]->brother, wwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paintflag)
|
if (paintflag)
|
||||||
wMenuPaint(menu);
|
wMenuPaint(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +325,8 @@ readUserMenuFile(WScreen *scr, char *file_name)
|
|||||||
|
|
||||||
|
|
||||||
WMenu*
|
WMenu*
|
||||||
wUserMenuGet(WScreen *scr, WWindow *wwin){
|
wUserMenuGet(WScreen *scr, WWindow *wwin)
|
||||||
|
{
|
||||||
WMenu *menu = NULL;
|
WMenu *menu = NULL;
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
|||||||
@@ -299,13 +299,17 @@
|
|||||||
#define DEF_ICON_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
#define DEF_ICON_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
||||||
#define DEF_CLIP_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
#define DEF_CLIP_TITLE_FONT "\"-*-*-medium-r-normal--10-*\""
|
||||||
#define DEF_INFO_TEXT_FONT "\"-*-*-medium-r-normal--14-*\""
|
#define DEF_INFO_TEXT_FONT "\"-*-*-medium-r-normal--14-*\""
|
||||||
#else /* I18N_MB */
|
|
||||||
|
#define DEF_WORKSPACE_NAME_FONT "-*-*-medium-r-normal--24-*"
|
||||||
|
#else /* !I18N_MB */
|
||||||
#define DEF_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\""
|
#define DEF_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\""
|
||||||
#define DEF_MENU_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\""
|
#define DEF_MENU_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\""
|
||||||
#define DEF_MENU_ENTRY_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\""
|
#define DEF_MENU_ENTRY_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\""
|
||||||
#define DEF_ICON_TITLE_FONT "\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*\""
|
#define DEF_ICON_TITLE_FONT "\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*\""
|
||||||
#define DEF_CLIP_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*\""
|
#define DEF_CLIP_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*\""
|
||||||
#define DEF_INFO_TEXT_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\""
|
#define DEF_INFO_TEXT_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\""
|
||||||
|
|
||||||
|
#define DEF_WORKSPACE_NAME_FONT "-*-times-bold-i-normal--24-*"
|
||||||
#endif /* !I18N_MB */
|
#endif /* !I18N_MB */
|
||||||
|
|
||||||
#define HELVETICA10_FONT "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*"
|
#define HELVETICA10_FONT "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*"
|
||||||
|
|||||||
178
src/workspace.c
178
src/workspace.c
@@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
#ifdef SHAPE
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -220,15 +224,185 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct WorkspaceNameData {
|
||||||
|
int count;
|
||||||
|
RImage *back;
|
||||||
|
RImage *text;
|
||||||
|
} WorkspaceNameData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
hideWorkpaceName(void *data)
|
||||||
|
{
|
||||||
|
WScreen *scr = (WScreen*)data;
|
||||||
|
|
||||||
|
|
||||||
|
if (!scr->workspace_name_data || scr->workspace_name_data->count == 0) {
|
||||||
|
XUnmapWindow(dpy, scr->workspace_name);
|
||||||
|
|
||||||
|
if (scr->workspace_name_data) {
|
||||||
|
RDestroyImage(scr->workspace_name_data->back);
|
||||||
|
RDestroyImage(scr->workspace_name_data->text);
|
||||||
|
free(scr->workspace_name_data);
|
||||||
|
|
||||||
|
scr->workspace_name_data = NULL;
|
||||||
|
}
|
||||||
|
scr->workspace_name_timer = NULL;
|
||||||
|
} else {
|
||||||
|
RImage *img = RCloneImage(scr->workspace_name_data->back);
|
||||||
|
Pixmap pix;
|
||||||
|
|
||||||
|
RCombineImagesWithOpaqueness(img, scr->workspace_name_data->text,
|
||||||
|
scr->workspace_name_data->count*255/10);
|
||||||
|
|
||||||
|
RConvertImage(scr->rcontext, img, &pix);
|
||||||
|
|
||||||
|
RDestroyImage(img);
|
||||||
|
|
||||||
|
XSetWindowBackgroundPixmap(dpy, scr->workspace_name, pix);
|
||||||
|
XClearWindow(dpy, scr->workspace_name);
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
|
XFlush(dpy);
|
||||||
|
|
||||||
|
scr->workspace_name_data->count--;
|
||||||
|
|
||||||
|
scr->workspace_name_timer = WMAddTimerHandler(40, hideWorkpaceName,
|
||||||
|
scr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
showWorkspaceName(WScreen *scr, int workspace)
|
||||||
|
{
|
||||||
|
WorkspaceNameData *data;
|
||||||
|
RXImage *ximg;
|
||||||
|
Pixmap text, mask;
|
||||||
|
int w, h;
|
||||||
|
char *name = scr->workspaces[workspace]->name;
|
||||||
|
int len = strlen(name);
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
if (scr->workspace_name_timer) {
|
||||||
|
WMDeleteTimerHandler(scr->workspace_name_timer);
|
||||||
|
XUnmapWindow(dpy, scr->workspace_name);
|
||||||
|
XFlush(dpy);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scr->workspace_name_data) {
|
||||||
|
RDestroyImage(scr->workspace_name_data->back);
|
||||||
|
RDestroyImage(scr->workspace_name_data->text);
|
||||||
|
free(scr->workspace_name_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef I18N_MB
|
||||||
|
XSetFont(dpy, scr->mono_gc, scr->workspace_name_font->font->fid);
|
||||||
|
XSetFont(dpy, scr->draw_gc, scr->workspace_name_font->font->fid);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
data = wmalloc(sizeof(WorkspaceNameData));
|
||||||
|
|
||||||
|
w = wTextWidth(scr->workspace_name_font->font, name, len);
|
||||||
|
h = scr->workspace_name_font->height;
|
||||||
|
|
||||||
|
XResizeWindow(dpy, scr->workspace_name, w+4, h+4);
|
||||||
|
XMoveWindow(dpy, scr->workspace_name, (scr->scr_width - (w+4))/2,
|
||||||
|
(scr->scr_height - (h+4))/2);
|
||||||
|
|
||||||
|
text = XCreatePixmap(dpy, scr->w_win, w+4, h+4, scr->w_depth);
|
||||||
|
mask = XCreatePixmap(dpy, scr->w_win, w+4, h+4, 1);
|
||||||
|
|
||||||
|
XSetForeground(dpy, scr->draw_gc, scr->black_pixel);
|
||||||
|
XFillRectangle(dpy, text, scr->draw_gc, 0, 0, w+4, h+4);
|
||||||
|
|
||||||
|
XSetForeground(dpy, scr->mono_gc, 0);
|
||||||
|
XFillRectangle(dpy, mask, scr->mono_gc, 0, 0, w+4, h+4);
|
||||||
|
|
||||||
|
XSetForeground(dpy, scr->mono_gc, 1);
|
||||||
|
for (x = 0; x <= 4; x++) {
|
||||||
|
for (y = 0; y <= 4; y++) {
|
||||||
|
wDrawString(mask, scr->workspace_name_font, scr->mono_gc,
|
||||||
|
x, scr->workspace_name_font->y + y, name, len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
|
||||||
|
wDrawString(text, scr->workspace_name_font, scr->draw_gc,
|
||||||
|
2, scr->workspace_name_font->y + 2,
|
||||||
|
scr->workspaces[workspace]->name,
|
||||||
|
strlen(scr->workspaces[workspace]->name));
|
||||||
|
#ifdef SHAPE
|
||||||
|
XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask,
|
||||||
|
ShapeSet);
|
||||||
|
#endif
|
||||||
|
XSetWindowBackgroundPixmap(dpy, scr->workspace_name, text);
|
||||||
|
XClearWindow(dpy, scr->workspace_name);
|
||||||
|
|
||||||
|
data->text = RCreateImageFromDrawable(scr->rcontext, text, None);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, text);
|
||||||
|
XFreePixmap(dpy, mask);
|
||||||
|
|
||||||
|
if (!data->text) {
|
||||||
|
XMapRaised(dpy, scr->workspace_name);
|
||||||
|
XFlush(dpy);
|
||||||
|
|
||||||
|
goto erro;
|
||||||
|
}
|
||||||
|
|
||||||
|
ximg = RGetXImage(scr->rcontext, scr->root_win,
|
||||||
|
(scr->scr_width - data->text->width)/2,
|
||||||
|
(scr->scr_height - data->text->height)/2,
|
||||||
|
data->text->width, data->text->height);
|
||||||
|
|
||||||
|
if (!ximg) {
|
||||||
|
goto erro;
|
||||||
|
}
|
||||||
|
|
||||||
|
XMapRaised(dpy, scr->workspace_name);
|
||||||
|
XFlush(dpy);
|
||||||
|
|
||||||
|
data->back = RCreateImageFromXImage(scr->rcontext, ximg->image, NULL);
|
||||||
|
RDestroyXImage(scr->rcontext, ximg);
|
||||||
|
|
||||||
|
if (!data->back) {
|
||||||
|
goto erro;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->count = 10;
|
||||||
|
|
||||||
|
scr->workspace_name_data = data;
|
||||||
|
|
||||||
|
scr->workspace_name_timer = WMAddTimerHandler(200, hideWorkpaceName, scr);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
erro:
|
||||||
|
if (data->text)
|
||||||
|
RDestroyImage(data->text);
|
||||||
|
if (data->back)
|
||||||
|
RDestroyImage(data->back);
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
scr->workspace_name_data = NULL;
|
||||||
|
|
||||||
|
scr->workspace_name_timer = WMAddTimerHandler(600, hideWorkpaceName, scr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceChange(WScreen *scr, int workspace)
|
wWorkspaceChange(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
if (scr->flags.startup || scr->flags.startup2) {
|
if (scr->flags.startup || scr->flags.startup2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workspace != scr->current_workspace) {
|
if (workspace != scr->current_workspace) {
|
||||||
wWorkspaceForceChange(scr, workspace);
|
wWorkspaceForceChange(scr, workspace);
|
||||||
|
} else {
|
||||||
|
showWorkspaceName(scr, workspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,6 +569,8 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showWorkspaceName(scr, workspace);
|
||||||
|
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
wGNOMEUpdateCurrentWorkspaceHint(scr);
|
wGNOMEUpdateCurrentWorkspaceHint(scr);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user