mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-28 00:23:33 +01:00
Compare commits
14 Commits
next
...
6d6f9f6ff5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d6f9f6ff5 | ||
|
|
370adc94e7 | ||
|
|
532acdc443 | ||
|
|
d7d38aa443 | ||
|
|
a6209cc89b | ||
|
|
01bd523cee | ||
|
|
45ab72a78a | ||
|
|
437b76812d | ||
|
|
e3ee459a78 | ||
|
|
d70b546f2e | ||
|
|
812930b7cd | ||
|
|
2a14004fc3 | ||
|
|
04e9f33437 | ||
|
|
150816c687 |
@@ -51,7 +51,7 @@ static WMColor *findCloseColor(WMScreen * scr, unsigned short red, unsigned shor
|
||||
color->refCount = 1;
|
||||
color->color = xcolor;
|
||||
color->alpha = alpha;
|
||||
color->flags.exact = 1;
|
||||
color->flags.exact = 0;
|
||||
color->gc = NULL;
|
||||
|
||||
return color;
|
||||
@@ -91,7 +91,7 @@ WMColor *WMCreateRGBColor(WMScreen * scr, unsigned short red, unsigned short gre
|
||||
color = findCloseColor(scr, red, green, blue, 0xffff);
|
||||
}
|
||||
if (!color)
|
||||
color = WMBlackColor(scr);
|
||||
color = scr->black;
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ WMColor *WMCreateRGBAColor(WMScreen * scr, unsigned short red, unsigned short gr
|
||||
color = findCloseColor(scr, red, green, blue, alpha);
|
||||
}
|
||||
if (!color)
|
||||
color = WMBlackColor(scr);
|
||||
color = scr->black;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -253,6 +253,9 @@ WMFrame *WMCreateFrame(WMWidget * parent)
|
||||
|
||||
static void destroyFrame(Frame * fPtr)
|
||||
{
|
||||
if (fPtr->textColor)
|
||||
WMReleaseColor(fPtr->textColor);
|
||||
|
||||
if (fPtr->caption)
|
||||
wfree(fPtr->caption);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ static void handleKeyPress(XEvent * event, void *clientData)
|
||||
|
||||
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||
|
||||
if (ksym == XK_Return && panel->defBtn) {
|
||||
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
|
||||
WMPerformButtonClick(panel->defBtn);
|
||||
} else if (ksym == XK_Escape) {
|
||||
if (panel->altBtn || panel->othBtn) {
|
||||
@@ -421,7 +421,7 @@ static void handleKeyPress2(XEvent * event, void *clientData)
|
||||
|
||||
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||
|
||||
if (ksym == XK_Return && panel->defBtn) {
|
||||
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
|
||||
WMPerformButtonClick(panel->defBtn);
|
||||
} else if (ksym == XK_Escape) {
|
||||
if (panel->altBtn) {
|
||||
@@ -709,7 +709,7 @@ static void handleKeyPress3(XEvent * event, void *clientData)
|
||||
|
||||
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||
|
||||
if (ksym == XK_Return && panel->defBtn) {
|
||||
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
|
||||
WMPerformButtonClick(panel->defBtn);
|
||||
} else if (ksym == XK_Escape) {
|
||||
if (panel->altBtn) {
|
||||
|
||||
@@ -320,7 +320,7 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
|
||||
/* conditional mask check to get numeric keypad keys */
|
||||
ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0);
|
||||
else
|
||||
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);
|
||||
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0);
|
||||
|
||||
if (!IsModifierKey(ksym)) {
|
||||
if (convert_case) {
|
||||
|
||||
@@ -384,7 +384,7 @@ static void fillModifierPopUp(WMPopUpButton * pop)
|
||||
if (xext_xkb_supported)
|
||||
ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l);
|
||||
else
|
||||
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0);
|
||||
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
|
||||
if (ksym != NoSymbol)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ AC_FUNC_MEMCMP
|
||||
AC_FUNC_VPRINTF
|
||||
WM_FUNC_SECURE_GETENV
|
||||
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
|
||||
setsid mallinfo mkstemp sysconf)
|
||||
setsid mallinfo2 mkstemp sysconf)
|
||||
AC_SEARCH_LIBS([strerror], [cposix])
|
||||
|
||||
dnl nanosleep is generally available in standard libc, although not always the
|
||||
|
||||
107
src/dialog.c
Normal file → Executable file
107
src/dialog.c
Normal file → Executable file
@@ -36,6 +36,8 @@
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
@@ -1153,7 +1155,7 @@ typedef struct {
|
||||
#define COPYRIGHT_TEXT \
|
||||
"Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\
|
||||
"Copyright \xc2\xa9 1998-2006 Dan Pascu\n"\
|
||||
"Copyright \xc2\xa9 2013-2020 Window Maker Developers Team"
|
||||
"Copyright \xc2\xa9 2013-%hu Window Maker Developers Team"
|
||||
|
||||
static InfoPanel *infoPanel = NULL;
|
||||
|
||||
@@ -1171,6 +1173,57 @@ static void destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
|
||||
infoPanel = NULL;
|
||||
}
|
||||
|
||||
char *getPrettyOSName(void)
|
||||
{
|
||||
char line[200];
|
||||
char *token;
|
||||
char *posn = NULL;
|
||||
const char s[2] = "=";
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen("/etc/os-release", "r");
|
||||
if (!fp) {
|
||||
fp = fopen("/usr/lib/os-release", "r");
|
||||
if (!fp) {
|
||||
wwarning(_("no os-release file on the system"));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
if (strncmp(line, "PRETTY_NAME", strlen("PRETTY_NAME")) == 0) {
|
||||
line[strcspn(line, "\r\n")] = 0;
|
||||
token = strtok(line, s);
|
||||
if (token) {
|
||||
//get straight to the second part of the line
|
||||
token = strtok(NULL, s);
|
||||
if (token) {
|
||||
//removing potential quotes
|
||||
char *dst = token;
|
||||
char *src = token;
|
||||
char c;
|
||||
|
||||
while ((c = *src++) != '\0') {
|
||||
if (c == '\\') {
|
||||
*dst++ = c;
|
||||
if ((c = *src++) == '\0')
|
||||
break;
|
||||
*dst++ = c;
|
||||
} else if (c != '"' && c != '\'')
|
||||
*dst++ = c;
|
||||
}
|
||||
*dst = '\0';
|
||||
posn = wmalloc(strlen(token) + 1);
|
||||
strcpy(posn, token);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
return posn;
|
||||
}
|
||||
|
||||
void wShowInfoPanel(WScreen *scr)
|
||||
{
|
||||
InfoPanel *panel;
|
||||
@@ -1194,6 +1247,17 @@ void wShowInfoPanel(WScreen *scr)
|
||||
};
|
||||
int wmScaleWidth, wmScaleHeight;
|
||||
int pwidth, pheight;
|
||||
int current_year = 2020;
|
||||
time_t s;
|
||||
struct tm *current_time;
|
||||
struct utsname uts;
|
||||
|
||||
s = time(NULL);
|
||||
if (s) {
|
||||
current_time = localtime(&s);
|
||||
if (current_time->tm_year > (current_year - 1900))
|
||||
current_year = current_time->tm_year + 1900;
|
||||
}
|
||||
|
||||
if (infoPanel) {
|
||||
if (infoPanel->scr == scr) {
|
||||
@@ -1209,8 +1273,12 @@ void wShowInfoPanel(WScreen *scr)
|
||||
|
||||
panel->win = WMCreateWindow(scr->wmscreen, "info");
|
||||
WMGetScaleBaseFromSystemFont(scr->wmscreen, &wmScaleWidth, &wmScaleHeight);
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
|
||||
pwidth = WMScaleX(412);
|
||||
#else
|
||||
pwidth = WMScaleX(382);
|
||||
pheight = WMScaleY(250);
|
||||
#endif
|
||||
pheight = WMScaleY(270);
|
||||
WMResizeWidget(panel->win, pwidth, pheight);
|
||||
|
||||
logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor *) NULL);
|
||||
@@ -1274,9 +1342,11 @@ void wShowInfoPanel(WScreen *scr)
|
||||
|
||||
panel->copyrL = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->copyrL, WMScaleX(360), WMScaleY(60));
|
||||
WMMoveWidget(panel->copyrL, WMScaleX(15), WMScaleY(190));
|
||||
WMMoveWidget(panel->copyrL, WMScaleX(15), WMScaleY(210));
|
||||
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
||||
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), COPYRIGHT_TEXT, current_year);
|
||||
WMSetLabelText(panel->copyrL, buffer);
|
||||
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
|
||||
if (font) {
|
||||
WMSetLabelFont(panel->copyrL, font);
|
||||
@@ -1285,9 +1355,19 @@ void wShowInfoPanel(WScreen *scr)
|
||||
}
|
||||
|
||||
strbuf = NULL;
|
||||
if (uname(&uts) != -1) {
|
||||
char *posn = getPrettyOSName();
|
||||
if (posn) {
|
||||
snprintf(buffer, sizeof(buffer), _("Running on: %s (%s)\n"), posn, uts.machine);
|
||||
free(posn);
|
||||
}
|
||||
else
|
||||
snprintf(buffer, sizeof(buffer), _("Running on: %s (%s)\n"), uts.sysname, uts.machine);
|
||||
strbuf = wstrappend(strbuf, buffer);
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer), _("Using visual 0x%x: %s %ibpp "),
|
||||
(unsigned)scr->w_visual->visualid, visuals[scr->w_visual->class], scr->w_depth);
|
||||
|
||||
strbuf = wstrappend(strbuf, buffer);
|
||||
|
||||
switch (scr->w_depth) {
|
||||
@@ -1307,14 +1387,14 @@ void wShowInfoPanel(WScreen *scr)
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2)
|
||||
{
|
||||
struct mallinfo ma = mallinfo();
|
||||
struct mallinfo2 ma = mallinfo2();
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
#ifdef DEBUG
|
||||
_("Total memory allocated: %i kB (in use: %i kB, %d free chunks).\n"),
|
||||
_("Total memory allocated: %lu kB (in use: %lu kB, %lu free chunks)\n"),
|
||||
#else
|
||||
_("Total memory allocated: %i kB (in use: %i kB).\n"),
|
||||
_("Total memory allocated: %lu kB (in use: %lu kB)\n"),
|
||||
#endif
|
||||
(ma.arena + ma.hblkhd) / 1024,
|
||||
(ma.uordblks + ma.hblkhd) / 1024
|
||||
@@ -1365,7 +1445,7 @@ void wShowInfoPanel(WScreen *scr)
|
||||
strbuf = wstrappend(strbuf, _("Xinerama: "));
|
||||
{
|
||||
char tmp[128];
|
||||
snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found."), scr->xine_info.count);
|
||||
snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found"), scr->xine_info.count);
|
||||
strbuf = wstrappend(strbuf, tmp);
|
||||
}
|
||||
#endif
|
||||
@@ -1377,11 +1457,14 @@ void wShowInfoPanel(WScreen *scr)
|
||||
strbuf = wstrappend(strbuf, _("supported"));
|
||||
else
|
||||
strbuf = wstrappend(strbuf, _("unsupported"));
|
||||
strbuf = wstrappend(strbuf, ".");
|
||||
#endif
|
||||
|
||||
panel->infoL = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->infoL, WMScaleX(350), WMScaleY(80));
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
|
||||
WMResizeWidget(panel->infoL, WMScaleX(380), WMScaleY(100));
|
||||
#else
|
||||
WMResizeWidget(panel->infoL, WMScaleX(350), WMScaleY(100));
|
||||
#endif
|
||||
WMMoveWidget(panel->infoL, WMScaleX(15), WMScaleY(115));
|
||||
WMSetLabelText(panel->infoL, strbuf);
|
||||
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
|
||||
|
||||
@@ -422,7 +422,7 @@ static char *get_icon_cache_path(void)
|
||||
{
|
||||
const char *prefix;
|
||||
char *path;
|
||||
int len, ret;
|
||||
int ret;
|
||||
|
||||
prefix = wuserdatapath();
|
||||
path = wstrconcat(prefix, CACHE_ICON_PATH "/");
|
||||
|
||||
@@ -186,7 +186,7 @@ static void exitCommand(WMenu * menu, WMenuEntry * entry)
|
||||
|
||||
oldSaveSessionFlag = wPreferences.save_session_on_exit;
|
||||
r = wExitDialog(menu->frame->screen_ptr, _("Exit"),
|
||||
_("Exit window manager?"), _("Exit"), _("Cancel"), NULL);
|
||||
_("Are you sure you want to quit Window Maker?"), _("Exit"), _("Cancel"), NULL);
|
||||
|
||||
if (r == WAPRDefault) {
|
||||
result = R_EXIT;
|
||||
|
||||
@@ -61,6 +61,7 @@ struct SwitchPanel {
|
||||
|
||||
WMFont *font;
|
||||
WMColor *white;
|
||||
WMColor *gray;
|
||||
};
|
||||
|
||||
/* these values will be updated whenever the switch panel
|
||||
@@ -154,11 +155,9 @@ static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim,
|
||||
border_space + pos.y, back->width, back->height, 0, 0);
|
||||
} else {
|
||||
RColor color;
|
||||
WMScreen *wscr = WMWidgetScreen(icon);
|
||||
color.red = 255;
|
||||
color.red = WMRedComponentOfColor(WMGrayColor(wscr)) >> 8;
|
||||
color.green = WMGreenComponentOfColor(WMGrayColor(wscr)) >> 8;
|
||||
color.blue = WMBlueComponentOfColor(WMGrayColor(wscr)) >> 8;
|
||||
color.red = WMRedComponentOfColor(panel->gray) >> 8;
|
||||
color.green = WMGreenComponentOfColor(panel->gray) >> 8;
|
||||
color.blue = WMBlueComponentOfColor(panel->gray) >> 8;
|
||||
RFillImage(back, &color);
|
||||
}
|
||||
|
||||
@@ -454,6 +453,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, Bool class_only)
|
||||
}
|
||||
|
||||
panel->white = WMWhiteColor(scr->wmscreen);
|
||||
panel->gray = WMGrayColor(scr->wmscreen);
|
||||
panel->font = WMBoldSystemFontOfSize(scr->wmscreen, WMScaleY(12));
|
||||
panel->icons = WMCreateArray(count);
|
||||
panel->images = WMCreateArray(count);
|
||||
@@ -589,6 +589,9 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
|
||||
if (panel->white)
|
||||
WMReleaseColor(panel->white);
|
||||
|
||||
if (panel->gray)
|
||||
WMReleaseColor(panel->gray);
|
||||
|
||||
wfree(panel);
|
||||
}
|
||||
|
||||
|
||||
@@ -1858,8 +1858,10 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
|
||||
int baseH = 0;
|
||||
|
||||
if (wwin->normal_hints) {
|
||||
if (!wwin->flags.maximized) {
|
||||
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;
|
||||
@@ -1922,6 +1924,7 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
|
||||
}
|
||||
}
|
||||
|
||||
if (!wwin->flags.maximized) {
|
||||
if (baseW != 0)
|
||||
width = (((width - baseW) / winc) * winc) + baseW;
|
||||
else
|
||||
@@ -1931,6 +1934,7 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
|
||||
height = (((height - baseH) / hinc) * hinc) + baseH;
|
||||
else
|
||||
height = (((height - minH) / hinc) * hinc) + minH;
|
||||
}
|
||||
|
||||
/* broken stupid apps may cause preposterous values for these.. */
|
||||
if (width > 0)
|
||||
|
||||
@@ -750,7 +750,7 @@ int main(int argc, char **argv)
|
||||
|
||||
dpy = XOpenDisplay(NULL);
|
||||
if (!dpy) {
|
||||
fprintf(stderr, "Error: can't open display");
|
||||
fprintf(stderr, "Error: can't open display\n");
|
||||
linked_list_free(&list);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <tiff.h>
|
||||
#include <tiffio.h>
|
||||
#include <tiffvers.h>
|
||||
|
||||
#include "wraster.h"
|
||||
#include "imgformat.h"
|
||||
@@ -38,14 +39,19 @@ RImage *RLoadTIFF(const char *file, int index)
|
||||
{
|
||||
RImage *image = NULL;
|
||||
TIFF *tif;
|
||||
int i;
|
||||
int i, ch;
|
||||
unsigned char *r, *g, *b, *a;
|
||||
uint16 alpha, amode;
|
||||
#if TIFFLIB_VERSION < 20210416
|
||||
uint16 alpha, amode, extrasamples;
|
||||
uint16 *sampleinfo;
|
||||
uint32 width, height;
|
||||
uint32 *data, *ptr;
|
||||
uint16 extrasamples;
|
||||
uint16 *sampleinfo;
|
||||
int ch;
|
||||
#else
|
||||
uint16_t alpha, amode, extrasamples;;
|
||||
uint16_t *sampleinfo;
|
||||
uint32_t width, height;
|
||||
uint32_t *data, *ptr;
|
||||
#endif
|
||||
|
||||
tif = TIFFOpen(file, "r");
|
||||
if (!tif)
|
||||
@@ -79,7 +85,11 @@ RImage *RLoadTIFF(const char *file, int index)
|
||||
}
|
||||
|
||||
/* read data */
|
||||
#if TIFFLIB_VERSION < 20210416
|
||||
ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32));
|
||||
#else
|
||||
ptr = data = (uint32_t *) _TIFFmalloc(width * height * sizeof(uint32_t));
|
||||
#endif
|
||||
|
||||
if (!data) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
|
||||
Reference in New Issue
Block a user