mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-03 23:05:46 +01:00
many bug fixes, finished some delegate code, updated menu file bug from EXEC
to SHEXEC, updated french translations
This commit is contained in:
19
src/dialog.c
19
src/dialog.c
@@ -266,23 +266,15 @@ setViewedImage(IconPanel *panel, char *file)
|
||||
pixmap = WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel->win),
|
||||
file, &color);
|
||||
if (!pixmap) {
|
||||
char *msg;
|
||||
char *tmp;
|
||||
|
||||
WMSetButtonEnabled(panel->okButton, False);
|
||||
|
||||
tmp = _("Could not load image file ");
|
||||
msg = wmalloc(strlen(tmp)+strlen(file)+6);
|
||||
strcpy(msg, tmp);
|
||||
strcat(msg, file);
|
||||
|
||||
wMessageDialog(panel->scr, _("Error"), msg, _("OK"), NULL, NULL);
|
||||
free(msg);
|
||||
WMSetLabelText(panel->iconView, _("Could not load image file "));
|
||||
|
||||
WMSetLabelImage(panel->iconView, NULL);
|
||||
} else {
|
||||
WMSetButtonEnabled(panel->okButton, True);
|
||||
|
||||
|
||||
WMSetLabelText(panel->iconView, NULL);
|
||||
WMSetLabelImage(panel->iconView, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
@@ -448,9 +440,10 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
||||
panel->iconView = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->iconView, 75, 75);
|
||||
WMMoveWidget(panel->iconView, 365, 60);
|
||||
WMSetLabelImagePosition(panel->iconView, WIPImageOnly);
|
||||
WMSetLabelImagePosition(panel->iconView, WIPOverlaps);
|
||||
WMSetLabelRelief(panel->iconView, WRSunken);
|
||||
|
||||
WMSetLabelTextAlignment(panel->iconView, WACenter);
|
||||
|
||||
panel->fileLabel = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->fileLabel, 80, 20);
|
||||
WMMoveWidget(panel->fileLabel, 10, 210);
|
||||
|
||||
@@ -356,7 +356,11 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
wsetabort(wAbort);
|
||||
|
||||
|
||||
/* for telling WPrefs what's the name of the wmaker binary being ran */
|
||||
str = wstrappend("WMAKER_BIN_NAME", argv[0]);
|
||||
putenv(str);
|
||||
|
||||
ArgCount = argc;
|
||||
Arguments = argv;
|
||||
|
||||
|
||||
@@ -1332,7 +1332,7 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
||||
if (dentry->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
buffer = wmalloc(strlen(path[i])+strlen(dentry->d_name)+4);
|
||||
buffer = malloc(strlen(path[i])+strlen(dentry->d_name)+4);
|
||||
if (!buffer) {
|
||||
wsyserror(_("out of memory while constructing directory menu %s"),
|
||||
path[i]);
|
||||
@@ -1399,7 +1399,7 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
||||
length = strlen(path[d->index])+strlen(d->name)+6;
|
||||
if (command)
|
||||
length += strlen(command) + 6;
|
||||
buffer = wmalloc(length);
|
||||
buffer = malloc(length);
|
||||
if (!buffer) {
|
||||
wsyserror(_("out of memory while constructing directory menu %s"),
|
||||
path[d->index]);
|
||||
@@ -1477,7 +1477,7 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
||||
if (ptr && ptr!=f->name)
|
||||
*ptr = 0;
|
||||
}
|
||||
addMenuEntry(menu, f->name, NULL, "EXEC", buffer, path[f->index]);
|
||||
addMenuEntry(menu, f->name, NULL, "SHEXEC", buffer, path[f->index]);
|
||||
|
||||
free(buffer);
|
||||
if (files->head) {
|
||||
|
||||
107
src/window.c
107
src/window.c
@@ -1674,77 +1674,92 @@ wWindowUnfocus(WWindow *wwin)
|
||||
void
|
||||
wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight)
|
||||
{
|
||||
XSizeHints *sizeh = wwin->normal_hints;
|
||||
int width = *nwidth;
|
||||
int height = *nheight;
|
||||
int winc = sizeh->width_inc;
|
||||
int hinc = sizeh->height_inc;
|
||||
int winc = 1;
|
||||
int hinc = 1;
|
||||
int minW = 1, minH = 1;
|
||||
int maxW = wwin->screen_ptr->scr_width*2;
|
||||
int maxH = wwin->screen_ptr->scr_height*2;
|
||||
int minAX = -1, minAY = -1;
|
||||
int maxAX = -1, maxAY = -1;
|
||||
int baseW = 0;
|
||||
int baseH = 0;
|
||||
|
||||
if (width < sizeh->min_width)
|
||||
width = sizeh->min_width;
|
||||
if (height < sizeh->min_height)
|
||||
height = sizeh->min_height;
|
||||
if (wwin->normal_hints) {
|
||||
winc = wwin->normal_hints->width_inc;
|
||||
hinc = wwin->normal_hints->height_inc;
|
||||
minW = wwin->normal_hints->min_width;
|
||||
minH = wwin->normal_hints->min_height;
|
||||
maxW = wwin->normal_hints->max_width;
|
||||
maxH = wwin->normal_hints->max_height;
|
||||
if (wwin->normal_hints->flags & PAspect) {
|
||||
minAX = wwin->normal_hints->min_aspect.x;
|
||||
minAY = wwin->normal_hints->min_aspect.y;
|
||||
maxAX = wwin->normal_hints->max_aspect.x;
|
||||
maxAY = wwin->normal_hints->max_aspect.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (width < minW)
|
||||
width = minW;
|
||||
if (height < minH)
|
||||
height = minH;
|
||||
|
||||
if (width > maxW)
|
||||
width = maxW;
|
||||
if (height > maxH)
|
||||
height = maxH;
|
||||
|
||||
if (width > sizeh->max_width)
|
||||
width = sizeh->max_width;
|
||||
if (height > sizeh->max_height)
|
||||
height = sizeh->max_height;
|
||||
|
||||
/* aspect ratio code borrowed from olwm */
|
||||
if (sizeh->flags & PAspect) {
|
||||
if (minAX > 0) {
|
||||
/* adjust max aspect ratio */
|
||||
if (!(sizeh->max_aspect.x==1 && sizeh->max_aspect.y==1)
|
||||
&& width * sizeh->max_aspect.y > height * sizeh->max_aspect.x) {
|
||||
if (sizeh->max_aspect.x > sizeh->max_aspect.y) {
|
||||
height = (width * sizeh->max_aspect.y) / sizeh->max_aspect.x;
|
||||
if (height > sizeh->max_height) {
|
||||
height = sizeh->max_height;
|
||||
width = (height*sizeh->max_aspect.x) / sizeh->max_aspect.y;
|
||||
if (!(maxAX == 1 && maxAY == 1) && width * maxAY > height * maxAX) {
|
||||
if (maxAX > maxAY) {
|
||||
height = (width * maxAY) / maxAX;
|
||||
if (height > maxH) {
|
||||
height = maxH;
|
||||
width = (height * maxAX) / maxAY;
|
||||
}
|
||||
} else {
|
||||
width = (height * sizeh->max_aspect.x) / sizeh->max_aspect.y;
|
||||
if (width > sizeh->max_width) {
|
||||
width = sizeh->max_width;
|
||||
height = (width*sizeh->max_aspect.y) / sizeh->max_aspect.x;
|
||||
width = (height * maxAX) / maxAY;
|
||||
if (width > maxW) {
|
||||
width = maxW;
|
||||
height = (width * maxAY) / maxAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* adjust min aspect ratio */
|
||||
if (!(sizeh->min_aspect.x==1 && sizeh->min_aspect.y==1)
|
||||
&& width * sizeh->min_aspect.y < height * sizeh->min_aspect.x) {
|
||||
if (sizeh->min_aspect.x > sizeh->min_aspect.y) {
|
||||
height = (width * sizeh->min_aspect.y) / sizeh->min_aspect.x;
|
||||
if (height < sizeh->min_height) {
|
||||
height = sizeh->min_height;
|
||||
width = (height*sizeh->min_aspect.x) / sizeh->min_aspect.y;
|
||||
if (!(minAX == 1 && minAY == 1) && width * minAY < height * minAX) {
|
||||
if (minAX > minAY) {
|
||||
height = (width * minAY) / minAX;
|
||||
if (height < minH) {
|
||||
height = minH;
|
||||
width = (height * minAX) / minAY;
|
||||
}
|
||||
} else {
|
||||
width = (height * sizeh->min_aspect.x) / sizeh->min_aspect.y;
|
||||
if (width < sizeh->min_width) {
|
||||
width = sizeh->min_width;
|
||||
height = (width*sizeh->min_aspect.y) / sizeh->min_aspect.x;
|
||||
width = (height * minAX) / minAY;
|
||||
if (width < minW) {
|
||||
width = minW;
|
||||
height = (width * minAY) / minAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeh->base_width != 0) {
|
||||
width = (((width - sizeh->base_width) / winc) * winc)
|
||||
+ sizeh->base_width;
|
||||
if (baseW != 0) {
|
||||
width = (((width - baseW) / winc) * winc) + baseW;
|
||||
} else {
|
||||
width = (((width - sizeh->min_width) / winc) * winc)
|
||||
+ sizeh->min_width;
|
||||
width = (((width - minW) / winc) * winc) + minW;
|
||||
}
|
||||
|
||||
if (sizeh->base_width != 0) {
|
||||
height = (((height - sizeh->base_height) / hinc) * hinc)
|
||||
+ sizeh->base_height;
|
||||
if (baseW != 0) {
|
||||
height = (((height - baseH) / hinc) * hinc) + baseH;
|
||||
} else {
|
||||
height = (((height - sizeh->min_height) / hinc) * hinc)
|
||||
+ sizeh->min_height;
|
||||
height = (((height - minH) / hinc) * hinc) + minH;
|
||||
}
|
||||
|
||||
|
||||
*nwidth = width;
|
||||
*nheight = height;
|
||||
}
|
||||
|
||||
@@ -988,12 +988,24 @@ static void
|
||||
selectSpecification(WMWidget *bPtr, void *data)
|
||||
{
|
||||
InspectorPanel *panel = (InspectorPanel*)data;
|
||||
char *str;
|
||||
|
||||
if (bPtr == panel->defaultRb) {
|
||||
WMSetButtonEnabled(panel->applyBtn, False);
|
||||
} else {
|
||||
WMSetButtonEnabled(panel->applyBtn, True);
|
||||
}
|
||||
|
||||
str = wmalloc(16 + strlen(wwin->wm_instance ? wwin->wm_instance : "?")
|
||||
+ strlen(wwin->wm_class ? wwin->wm_class : "?"));
|
||||
|
||||
sprintf(str, "Inspecting %s.%s",
|
||||
wwin->wm_instance ? wwin->wm_instance : "?",
|
||||
wwin->wm_class ? wwin->wm_class : "?");
|
||||
|
||||
wFrameWindowChangeTitle(panel->wwin->frame, str);
|
||||
|
||||
free(str);
|
||||
}
|
||||
|
||||
|
||||
@@ -1003,13 +1015,15 @@ createInspectorForWindow(WWindow *wwin)
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
InspectorPanel *panel;
|
||||
Window parent;
|
||||
char charbuf[128];
|
||||
int i;
|
||||
int x, y;
|
||||
int btn_width, frame_width;
|
||||
WMButton *selectedBtn = NULL;
|
||||
#ifdef wrong_behaviour
|
||||
WMPixmap *pixmap;
|
||||
#endif
|
||||
|
||||
|
||||
panel = wmalloc(sizeof(InspectorPanel));
|
||||
memset(panel, 0, sizeof(InspectorPanel));
|
||||
|
||||
@@ -1020,11 +1034,7 @@ createInspectorForWindow(WWindow *wwin)
|
||||
|
||||
panel->nextPtr = panelList;
|
||||
panelList = panel;
|
||||
|
||||
|
||||
sprintf(charbuf, "Inspecting %s.%s",
|
||||
wwin->wm_instance ? wwin->wm_instance : "?",
|
||||
wwin->wm_class ? wwin->wm_class : "?");
|
||||
|
||||
panel->win = WMCreateWindow(scr->wmscreen, "windowInspector");
|
||||
WMResizeWidget(panel->win, PWIDTH, PHEIGHT);
|
||||
@@ -1082,17 +1092,21 @@ createInspectorForWindow(WWindow *wwin)
|
||||
WMSetButtonText(panel->defaultRb, _("Defaults for all windows"));
|
||||
WMSetButtonSelected(panel->defaultRb, False);
|
||||
WMSetButtonAction(panel->defaultRb, selectSpecification, panel);
|
||||
|
||||
|
||||
|
||||
if (wwin->wm_class && wwin->wm_instance) {
|
||||
sprintf(charbuf, "%s.%s", wwin->wm_instance, wwin->wm_class);
|
||||
char *str;
|
||||
|
||||
str = wstrappend(wwin->wm_instance, wwin->wm_class);
|
||||
panel->bothRb = WMCreateRadioButton(panel->specFrm);
|
||||
WMMoveWidget(panel->bothRb, 10, 18);
|
||||
WMResizeWidget(panel->bothRb, frame_width - (2 * 10), 20);
|
||||
WMSetButtonText(panel->bothRb, charbuf);
|
||||
WMSetButtonSelected(panel->bothRb, True);
|
||||
WMSetButtonText(panel->bothRb, str);
|
||||
free(str);
|
||||
WMGroupButtons(panel->defaultRb, panel->bothRb);
|
||||
|
||||
if (!selectedBtn)
|
||||
selectedBtn = panel->bothRb;
|
||||
|
||||
WMSetButtonAction(panel->bothRb, selectSpecification, panel);
|
||||
}
|
||||
|
||||
@@ -1101,9 +1115,11 @@ createInspectorForWindow(WWindow *wwin)
|
||||
WMMoveWidget(panel->instRb, 10, 38);
|
||||
WMResizeWidget(panel->instRb, frame_width - (2 * 10), 20);
|
||||
WMSetButtonText(panel->instRb, wwin->wm_instance);
|
||||
WMSetButtonSelected(panel->instRb, False);
|
||||
WMGroupButtons(panel->defaultRb, panel->instRb);
|
||||
|
||||
if (!selectedBtn)
|
||||
selectedBtn = panel->instRb;
|
||||
|
||||
WMSetButtonAction(panel->instRb, selectSpecification, panel);
|
||||
}
|
||||
|
||||
@@ -1112,9 +1128,11 @@ createInspectorForWindow(WWindow *wwin)
|
||||
WMMoveWidget(panel->clsRb, 10, 58);
|
||||
WMResizeWidget(panel->clsRb, frame_width - (2 * 10), 20);
|
||||
WMSetButtonText(panel->clsRb, wwin->wm_class);
|
||||
WMSetButtonSelected(panel->clsRb, False);
|
||||
WMGroupButtons(panel->defaultRb, panel->clsRb);
|
||||
|
||||
if (!selectedBtn)
|
||||
selectedBtn = panel->clsRb;
|
||||
|
||||
WMSetButtonAction(panel->clsRb, selectSpecification, panel);
|
||||
}
|
||||
|
||||
@@ -1467,7 +1485,7 @@ createInspectorForWindow(WWindow *wwin)
|
||||
XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0);
|
||||
|
||||
WMMapWidget(panel->win);
|
||||
|
||||
|
||||
XSetTransientForHint(dpy, parent, wwin->client_win);
|
||||
|
||||
x = wwin->frame_x+wwin->frame->core->width/2;
|
||||
@@ -1476,12 +1494,18 @@ createInspectorForWindow(WWindow *wwin)
|
||||
y = scr->scr_height - PHEIGHT - 30;
|
||||
if (x + PWIDTH > scr->scr_width)
|
||||
x = scr->scr_width - PWIDTH;
|
||||
|
||||
panel->frame = wManageInternalWindow(scr, parent, wwin->client_win,
|
||||
charbuf, x, y, PWIDTH, PHEIGHT);
|
||||
|
||||
"Inspector", x, y, PWIDTH, PHEIGHT);
|
||||
|
||||
if (!selectedBtn)
|
||||
selectedBtn = panel->defaultRb;
|
||||
|
||||
selectSpecification(selectedBtn, panel);
|
||||
|
||||
/* kluge to know who should get the key events */
|
||||
panel->frame->client_leader = WMWidgetXID(panel->win);
|
||||
|
||||
|
||||
WSETUFLAG(panel->frame, no_closable, 0);
|
||||
WSETUFLAG(panel->frame, no_close_button, 0);
|
||||
wWindowUpdateButtonImages(panel->frame);
|
||||
|
||||
@@ -289,7 +289,8 @@ showWorkspaceName(WScreen *scr, int workspace)
|
||||
int len = strlen(name);
|
||||
int x, y;
|
||||
|
||||
if (wPreferences.workspace_name_display_position == WD_NONE)
|
||||
if (wPreferences.workspace_name_display_position == WD_NONE
|
||||
|| scr->workspace_count < 2)
|
||||
return;
|
||||
|
||||
if (scr->workspace_name_timer) {
|
||||
@@ -605,6 +606,7 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
|
||||
if (scr->dock)
|
||||
wAppIconPaint(scr->dock->icon_array[0]);
|
||||
|
||||
if (scr->clip_icon) {
|
||||
if (scr->workspaces[workspace]->clip->auto_collapse ||
|
||||
scr->workspaces[workspace]->clip->auto_raise_lower) {
|
||||
@@ -616,7 +618,8 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||
}
|
||||
}
|
||||
|
||||
showWorkspaceName(scr, workspace);
|
||||
if (!scr->flags.startup2)
|
||||
showWorkspaceName(scr, workspace);
|
||||
|
||||
#ifdef GNOME_STUFF
|
||||
wGNOMEUpdateCurrentWorkspaceHint(scr);
|
||||
|
||||
Reference in New Issue
Block a user