1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-28 17:03:33 +01:00

14 Commits

Author SHA1 Message Date
David Maciejak
6d6f9f6ff5 Info Panel: Fix uninitialized posn variable 2023-02-16 11:34:54 +00:00
David Maciejak
370adc94e7 Ignore WM_NORMAL_HINTS resize increment for maximized windows
If you are trying to maximize old apps that are setting a resize increment
in term of WM_NORMAL_HINTS notion the window will not be maximized fully (by a few pixels).
It's easy to reproduce with xterm, ctrl double click on the title bar.
xprop extract sample is giving:
program specified resize increment: 6 by 13

For those maximized windows the patch is just ignoring the resize increment.
Seems the same issue happened on that project
https://github.com/paperwm/PaperWM/issues/106
2023-02-16 01:21:25 +00:00
David Maciejak
532acdc443 WRaster: Avoid types deprecated with libtiff 4.3
This patch is fixing compiler warnings like:

load_tiff.c:42:9: warning: 'uint16' is deprecated [-Wdeprecated-declarations]
load_tiff.c:43:9: warning: 'uint32' is deprecated [-Wdeprecated-declarations]

As starting from libtiff 4.3, released in April 2021, types were moved
from uint16 to uint16_t and uint32 to uint32_t respectively.

See https://libtiff.gitlab.io/libtiff/releases/v4.3.0.html
2023-02-15 11:24:09 +00:00
David Maciejak
d7d38aa443 Info Panel: display more OS details
Rely on old utsname and os-release (http://0pointer.de/blog/projects/os-release) when available
to display more underlying OS details in the Info panel.
The idea is when someone creates a bug entry we can request them to copy/paste that screen
to give more info about the context that could help us debug the issue.
For example, on my current system it's displaying:
"Running on: Ubuntu 22.10 (x86_64)"
2023-02-15 09:37:06 +00:00
David Maciejak
a6209cc89b Set a better exit panel message
Replace the exit window manager generic message with Window Maker term instead.
2023-02-15 09:37:06 +00:00
David Maciejak
01bd523cee WINGs: allow keypad enter key to validate button
This patch allows the keypad enter key to validate the button click action.
2023-02-15 09:37:06 +00:00
David Maciejak
45ab72a78a InfoPanel: fix out of display text
When debug is enabled, the memory allocated details is supposed to display the free chunks
but as the text length is too long it's getting out of the display area.
This patch is increasing the window width to handle such case.
2023-02-13 13:10:14 +00:00
David Maciejak
437b76812d Info Panel: mallinfo is deprecated use mallinfo2 instead
Replacing mallinfo with mallinfo2.

The fields of the mallinfo structure that is returned by the
older mallinfo() function are typed as int.  However, because
some internal bookkeeping values may be of type long, the
reported values may wrap around zero and thus be inaccurate.
2023-02-11 10:35:23 +00:00
David Maciejak
e3ee459a78 Info Panel: use system time to get the current year
Use the system date to get the current year to insert inside the copyright line.
So no need to update that string anymore.
2023-02-11 10:33:22 +00:00
David Maciejak
d70b546f2e Fix wrong XKeycodeToKeysym index value
XKeycodeToKeysym was deprecated some time ago and wmaker code was patched to use the definition from XKBlib instead.
(https://repo.or.cz/wmaker-crm.git?a=commit;h=0382dd5dd7ecae2112a0c6366eaf9e6ab68ad354)

Before being deprecated,  XKeycodeToKeysym was prototyped at X11/Xlib.h as
KeySym XKeycodeToKeysym(display, keycode, index)

Now it's available in X11/XKBlib.h as
KeySym XkbKeycodeToKeysym(display, keycode, group, level)

Basically level now which is the 4th parameter is our old index variable (3rd parameter).

On systems which don't have xkb supported the value set for index is wrong.
As seen in old patch at https://repo.or.cz/wmaker-crm.git/blobdiff/139f912e618870cc7fd908099f203450547eb658..43c3526d2120712f72579398b73ef92283d9078b:/WPrefs.app/MouseSettings.c
we should pass the l value to old XKeycodeToKeysym function and not the 0 value which is used for the group in the new XkbKeycodeToKeysym definition.
2023-02-11 10:30:52 +00:00
David Maciejak
812930b7cd Fix icon.c unused variable compiler warning
Just to please the compiler as it's reporting:
icon.c: In function 'get_icon_cache_path':
icon.c:425:13: warning: unused variable 'len' [-Wunused-variable]
2023-02-11 10:30:02 +00:00
David Maciejak
2a14004fc3 SwitchPanel: make sure WMRetainColor and WMReleaseColor calls are even
The number of calls to WMRetainColor for a color in use should the same as the number of calls to WMReleaseColor
to free that color. In case of discrepancy, random crashes can happen and memory is not freed properly.
To debug that issue I checked the retained colors when the switchpanel is opened and then checked if those colors are properly released once the panel is closed.

This patch fixes the issue mentioned at https://github.com/window-maker/wmaker/issues/22
2023-02-10 11:24:55 +00:00
David Maciejak
04e9f33437 WINGs: Fix incorrect findCloseColor exact flag value
In case the color cannot be allocated exactly by createRGBAColor function,
the findCloseColor function is used as a failover function to find a color close to the requested color.
By definition that color is then not exact.
createRGBAColor exact flag should be 1 while findCloseColor exact flag should be 0
2023-02-10 11:24:44 +00:00
David Maciejak
150816c687 Fix missing linefeed on the error message
Just to display the error message properly in case there is no display.
2023-02-08 00:14:48 +00:00
13 changed files with 147 additions and 44 deletions

View File

@@ -51,7 +51,7 @@ static WMColor *findCloseColor(WMScreen * scr, unsigned short red, unsigned shor
color->refCount = 1; color->refCount = 1;
color->color = xcolor; color->color = xcolor;
color->alpha = alpha; color->alpha = alpha;
color->flags.exact = 1; color->flags.exact = 0;
color->gc = NULL; color->gc = NULL;
return color; return color;
@@ -91,7 +91,7 @@ WMColor *WMCreateRGBColor(WMScreen * scr, unsigned short red, unsigned short gre
color = findCloseColor(scr, red, green, blue, 0xffff); color = findCloseColor(scr, red, green, blue, 0xffff);
} }
if (!color) if (!color)
color = WMBlackColor(scr); color = scr->black;
return color; return color;
} }
@@ -117,7 +117,7 @@ WMColor *WMCreateRGBAColor(WMScreen * scr, unsigned short red, unsigned short gr
color = findCloseColor(scr, red, green, blue, alpha); color = findCloseColor(scr, red, green, blue, alpha);
} }
if (!color) if (!color)
color = WMBlackColor(scr); color = scr->black;
return color; return color;
} }

View File

@@ -253,6 +253,9 @@ WMFrame *WMCreateFrame(WMWidget * parent)
static void destroyFrame(Frame * fPtr) static void destroyFrame(Frame * fPtr)
{ {
if (fPtr->textColor)
WMReleaseColor(fPtr->textColor);
if (fPtr->caption) if (fPtr->caption)
wfree(fPtr->caption); wfree(fPtr->caption);

View File

@@ -25,7 +25,7 @@ static void handleKeyPress(XEvent * event, void *clientData)
XLookupString(&event->xkey, NULL, 0, &ksym, NULL); 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); WMPerformButtonClick(panel->defBtn);
} else if (ksym == XK_Escape) { } else if (ksym == XK_Escape) {
if (panel->altBtn || panel->othBtn) { if (panel->altBtn || panel->othBtn) {
@@ -421,7 +421,7 @@ static void handleKeyPress2(XEvent * event, void *clientData)
XLookupString(&event->xkey, NULL, 0, &ksym, NULL); 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); WMPerformButtonClick(panel->defBtn);
} else if (ksym == XK_Escape) { } else if (ksym == XK_Escape) {
if (panel->altBtn) { if (panel->altBtn) {
@@ -709,7 +709,7 @@ static void handleKeyPress3(XEvent * event, void *clientData)
XLookupString(&event->xkey, NULL, 0, &ksym, NULL); 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); WMPerformButtonClick(panel->defBtn);
} else if (ksym == XK_Escape) { } else if (ksym == XK_Escape) {
if (panel->altBtn) { if (panel->altBtn) {

View File

@@ -320,7 +320,7 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
/* conditional mask check to get numeric keypad keys */ /* conditional mask check to get numeric keypad keys */
ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0); ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0);
else 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 (!IsModifierKey(ksym)) {
if (convert_case) { if (convert_case) {

View File

@@ -384,7 +384,7 @@ static void fillModifierPopUp(WMPopUpButton * pop)
if (xext_xkb_supported) if (xext_xkb_supported)
ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l); ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l);
else else
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0); ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
if (ksym != NoSymbol) if (ksym != NoSymbol)
break; break;
} }

View File

@@ -387,7 +387,7 @@ AC_FUNC_MEMCMP
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
WM_FUNC_SECURE_GETENV WM_FUNC_SECURE_GETENV
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \ AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
setsid mallinfo mkstemp sysconf) setsid mallinfo2 mkstemp sysconf)
AC_SEARCH_LIBS([strerror], [cposix]) AC_SEARCH_LIBS([strerror], [cposix])
dnl nanosleep is generally available in standard libc, although not always the dnl nanosleep is generally available in standard libc, although not always the

107
src/dialog.c Normal file → Executable file
View File

@@ -36,6 +36,8 @@
#include <dirent.h> #include <dirent.h>
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <time.h>
#include <sys/utsname.h>
#ifdef HAVE_MALLOC_H #ifdef HAVE_MALLOC_H
#include <malloc.h> #include <malloc.h>
@@ -1153,7 +1155,7 @@ typedef struct {
#define COPYRIGHT_TEXT \ #define COPYRIGHT_TEXT \
"Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\ "Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\
"Copyright \xc2\xa9 1998-2006 Dan Pascu\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; static InfoPanel *infoPanel = NULL;
@@ -1171,6 +1173,57 @@ static void destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
infoPanel = NULL; 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) void wShowInfoPanel(WScreen *scr)
{ {
InfoPanel *panel; InfoPanel *panel;
@@ -1194,6 +1247,17 @@ void wShowInfoPanel(WScreen *scr)
}; };
int wmScaleWidth, wmScaleHeight; int wmScaleWidth, wmScaleHeight;
int pwidth, pheight; 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) {
if (infoPanel->scr == scr) { if (infoPanel->scr == scr) {
@@ -1209,8 +1273,12 @@ void wShowInfoPanel(WScreen *scr)
panel->win = WMCreateWindow(scr->wmscreen, "info"); panel->win = WMCreateWindow(scr->wmscreen, "info");
WMGetScaleBaseFromSystemFont(scr->wmscreen, &wmScaleWidth, &wmScaleHeight); WMGetScaleBaseFromSystemFont(scr->wmscreen, &wmScaleWidth, &wmScaleHeight);
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
pwidth = WMScaleX(412);
#else
pwidth = WMScaleX(382); pwidth = WMScaleX(382);
pheight = WMScaleY(250); #endif
pheight = WMScaleY(270);
WMResizeWidget(panel->win, pwidth, pheight); WMResizeWidget(panel->win, pwidth, pheight);
logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor *) NULL); logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor *) NULL);
@@ -1274,9 +1342,11 @@ void wShowInfoPanel(WScreen *scr)
panel->copyrL = WMCreateLabel(panel->win); panel->copyrL = WMCreateLabel(panel->win);
WMResizeWidget(panel->copyrL, WMScaleX(360), WMScaleY(60)); 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); 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)); font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
if (font) { if (font) {
WMSetLabelFont(panel->copyrL, font); WMSetLabelFont(panel->copyrL, font);
@@ -1285,9 +1355,19 @@ void wShowInfoPanel(WScreen *scr)
} }
strbuf = NULL; 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 "), snprintf(buffer, sizeof(buffer), _("Using visual 0x%x: %s %ibpp "),
(unsigned)scr->w_visual->visualid, visuals[scr->w_visual->class], scr->w_depth); (unsigned)scr->w_visual->visualid, visuals[scr->w_visual->class], scr->w_depth);
strbuf = wstrappend(strbuf, buffer); strbuf = wstrappend(strbuf, buffer);
switch (scr->w_depth) { switch (scr->w_depth) {
@@ -1307,14 +1387,14 @@ void wShowInfoPanel(WScreen *scr)
break; 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), snprintf(buffer, sizeof(buffer),
#ifdef DEBUG #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 #else
_("Total memory allocated: %i kB (in use: %i kB).\n"), _("Total memory allocated: %lu kB (in use: %lu kB)\n"),
#endif #endif
(ma.arena + ma.hblkhd) / 1024, (ma.arena + ma.hblkhd) / 1024,
(ma.uordblks + ma.hblkhd) / 1024 (ma.uordblks + ma.hblkhd) / 1024
@@ -1365,7 +1445,7 @@ void wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, _("Xinerama: ")); strbuf = wstrappend(strbuf, _("Xinerama: "));
{ {
char tmp[128]; 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); strbuf = wstrappend(strbuf, tmp);
} }
#endif #endif
@@ -1377,11 +1457,14 @@ void wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, _("supported")); strbuf = wstrappend(strbuf, _("supported"));
else else
strbuf = wstrappend(strbuf, _("unsupported")); strbuf = wstrappend(strbuf, _("unsupported"));
strbuf = wstrappend(strbuf, ".");
#endif #endif
panel->infoL = WMCreateLabel(panel->win); 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)); WMMoveWidget(panel->infoL, WMScaleX(15), WMScaleY(115));
WMSetLabelText(panel->infoL, strbuf); WMSetLabelText(panel->infoL, strbuf);
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11)); font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));

View File

@@ -422,7 +422,7 @@ static char *get_icon_cache_path(void)
{ {
const char *prefix; const char *prefix;
char *path; char *path;
int len, ret; int ret;
prefix = wuserdatapath(); prefix = wuserdatapath();
path = wstrconcat(prefix, CACHE_ICON_PATH "/"); path = wstrconcat(prefix, CACHE_ICON_PATH "/");

View File

@@ -186,7 +186,7 @@ static void exitCommand(WMenu * menu, WMenuEntry * entry)
oldSaveSessionFlag = wPreferences.save_session_on_exit; oldSaveSessionFlag = wPreferences.save_session_on_exit;
r = wExitDialog(menu->frame->screen_ptr, _("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) { if (r == WAPRDefault) {
result = R_EXIT; result = R_EXIT;

View File

@@ -61,6 +61,7 @@ struct SwitchPanel {
WMFont *font; WMFont *font;
WMColor *white; WMColor *white;
WMColor *gray;
}; };
/* these values will be updated whenever the switch panel /* 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); border_space + pos.y, back->width, back->height, 0, 0);
} else { } else {
RColor color; RColor color;
WMScreen *wscr = WMWidgetScreen(icon); color.red = WMRedComponentOfColor(panel->gray) >> 8;
color.red = 255; color.green = WMGreenComponentOfColor(panel->gray) >> 8;
color.red = WMRedComponentOfColor(WMGrayColor(wscr)) >> 8; color.blue = WMBlueComponentOfColor(panel->gray) >> 8;
color.green = WMGreenComponentOfColor(WMGrayColor(wscr)) >> 8;
color.blue = WMBlueComponentOfColor(WMGrayColor(wscr)) >> 8;
RFillImage(back, &color); RFillImage(back, &color);
} }
@@ -454,6 +453,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, Bool class_only)
} }
panel->white = WMWhiteColor(scr->wmscreen); panel->white = WMWhiteColor(scr->wmscreen);
panel->gray = WMGrayColor(scr->wmscreen);
panel->font = WMBoldSystemFontOfSize(scr->wmscreen, WMScaleY(12)); panel->font = WMBoldSystemFontOfSize(scr->wmscreen, WMScaleY(12));
panel->icons = WMCreateArray(count); panel->icons = WMCreateArray(count);
panel->images = WMCreateArray(count); panel->images = WMCreateArray(count);
@@ -589,6 +589,9 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
if (panel->white) if (panel->white)
WMReleaseColor(panel->white); WMReleaseColor(panel->white);
if (panel->gray)
WMReleaseColor(panel->gray);
wfree(panel); wfree(panel);
} }

View File

@@ -1858,8 +1858,10 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
int baseH = 0; int baseH = 0;
if (wwin->normal_hints) { if (wwin->normal_hints) {
if (!wwin->flags.maximized) {
winc = wwin->normal_hints->width_inc; winc = wwin->normal_hints->width_inc;
hinc = wwin->normal_hints->height_inc; hinc = wwin->normal_hints->height_inc;
}
minW = wwin->normal_hints->min_width; minW = wwin->normal_hints->min_width;
minH = wwin->normal_hints->min_height; minH = wwin->normal_hints->min_height;
maxW = wwin->normal_hints->max_width; 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) if (baseW != 0)
width = (((width - baseW) / winc) * winc) + baseW; width = (((width - baseW) / winc) * winc) + baseW;
else else
@@ -1931,6 +1934,7 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
height = (((height - baseH) / hinc) * hinc) + baseH; height = (((height - baseH) / hinc) * hinc) + baseH;
else else
height = (((height - minH) / hinc) * hinc) + minH; height = (((height - minH) / hinc) * hinc) + minH;
}
/* broken stupid apps may cause preposterous values for these.. */ /* broken stupid apps may cause preposterous values for these.. */
if (width > 0) if (width > 0)

View File

@@ -750,7 +750,7 @@ int main(int argc, char **argv)
dpy = XOpenDisplay(NULL); dpy = XOpenDisplay(NULL);
if (!dpy) { if (!dpy) {
fprintf(stderr, "Error: can't open display"); fprintf(stderr, "Error: can't open display\n");
linked_list_free(&list); linked_list_free(&list);
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@@ -28,6 +28,7 @@
#include <tiff.h> #include <tiff.h>
#include <tiffio.h> #include <tiffio.h>
#include <tiffvers.h>
#include "wraster.h" #include "wraster.h"
#include "imgformat.h" #include "imgformat.h"
@@ -38,14 +39,19 @@ RImage *RLoadTIFF(const char *file, int index)
{ {
RImage *image = NULL; RImage *image = NULL;
TIFF *tif; TIFF *tif;
int i; int i, ch;
unsigned char *r, *g, *b, *a; unsigned char *r, *g, *b, *a;
uint16 alpha, amode; #if TIFFLIB_VERSION < 20210416
uint16 alpha, amode, extrasamples;
uint16 *sampleinfo;
uint32 width, height; uint32 width, height;
uint32 *data, *ptr; uint32 *data, *ptr;
uint16 extrasamples; #else
uint16 *sampleinfo; uint16_t alpha, amode, extrasamples;;
int ch; uint16_t *sampleinfo;
uint32_t width, height;
uint32_t *data, *ptr;
#endif
tif = TIFFOpen(file, "r"); tif = TIFFOpen(file, "r");
if (!tif) if (!tif)
@@ -79,7 +85,11 @@ RImage *RLoadTIFF(const char *file, int index)
} }
/* read data */ /* read data */
#if TIFFLIB_VERSION < 20210416
ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32)); ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32));
#else
ptr = data = (uint32_t *) _TIFFmalloc(width * height * sizeof(uint32_t));
#endif
if (!data) { if (!data) {
RErrorCode = RERR_NOMEMORY; RErrorCode = RERR_NOMEMORY;