1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 14:08:06 +01:00
Commit Graph

1048 Commits

Author SHA1 Message Date
Christophe CURIS
3bf2978e63 WINGs: remove macro ABS_SHIFT from the wcolorpanel code
This macro was define a *very* long time ago, in commit
  d98f1fa645
but was not used at that time, and have never been used anywhere since
then.

As the macro does not look like a good idea for performance anyway, get rid
of it before anyone could get tempted to use it.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
59106395c0 WINGs: remove dead code from 'loadPixmaps'
It seems the code had the possibility to load a default icon, probably to
be used on the windows if the main program does not provide any.

This code however have never been enabled, probably because it is better to
not provide an icon and let the window manager use its own.

This patch then removes that dead code, but keeps the image as part of the
WINGs resource for the case where an application would have been using it.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
e09df40f78 WINGs: remove unused macro NFONT in wbutton
As pointed by gcc, this macro is never used in the code; when no font is
defined by user the 'paintButton' code already falls back to the
'normalFont' of the screen, and this code could not need the macro anyway.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
4b0838e93a WINGs: remove unused constant DEFAULT_BORDER_WIDTH in wcolorwell
As pointed by gcc, this constant is not used anywhere, and it looks like
it have always been the case. As there's no reason to specifically add a
border to this widget, remove the constant.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
781fd777eb WINGs: remove constants used for default width+height for the widget
As pointed by gcc, the height is never used and the code make use of the
SCROLLER_WIDTH constant anyway, so this patch updates the code to directly
use that constant instead of intermediate values that just adds noise for
code maintainability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
03385c3d78 WINGs: remove the macro DEFAULT_TITLE because it is not used
As pointed by gcc, the macro is not used, that is probably because it is
totally ok to never provide a title from X point of view, so there is now
reason to fall back to that empty constant.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
David Maciejak
c10469264d WINGs: add functions to set widget background image
With this patch we can set widget background image.
As now, only background color was available.
2014-12-07 09:52:21 +00:00
Christophe CURIS
47ac986b53 Make sub-directories visible the automake's "dist*" targets
We have a few directories with source codes that we tell configure to
prepare, but we do not actually want them built during normal operations
(tests and examples only).

However, there are some special targets brought by automake which still
need to see them, so this patch adds these directories to the list, but
only for these rules, we keep them unvisited by the normal build process.

The wanted side effect of this is that now "make distcheck" works untill
the end as expectable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-07 09:52:21 +00:00
Christophe CURIS
63733c9133 WINGs: fix possible problems due to sign extension when setting Icon (Coverity #50202)
As pointed by Coverity, there might be some problems due to sign extension
when performing the shifts and ors operations when converting the RImage to
the format expected for the WM_ICON property.

This patch try to improve things by using as much as possible unsigned
types and by using explicit types conversion instead of counting on the
wrong implicit type conversion done by the language.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 18:44:47 +00:00
Christophe CURIS
c5d4c27a90 WINGs: to not allocate memory for a short lived array (Coverity #50136)
As pointed by Coverity, the array created to temporary store the list of
Atoms used in the function 'requestHandler' was leaked.

Because this array is very short lived, there is no need to allocate memory
for this, it just participates in memory fragmentation. Instead, we use now
memory on the stack which is more efficient.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 18:44:47 +00:00
Christophe CURIS
b80118fb41 WINGs: fix WMPathForResourceOfType to check for all the paths it claims to check
The "documentation" of the function claims to check for the resource in a
number of path, but factually if the application did provide its argument
list when creating the WINGs App structure (which is likely) then the
search would stop before checking all paths.

The code now continues as expectable if the resource was not found in the
path. Took opportunity to avoid a temporary allocation that participated in
memory fragmentation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 18:44:47 +00:00
Christophe CURIS
4f050ebab9 WINGs: fix infinite loop when using Pango on string that have to be split
As reported by Charles Philip Chan, WPrefs would get into infinite loop
when the support for Pango is enabled.

The problem is due to long strings that are broken into multiple lines by
WINGs. This is done in an iterative process in the internal function
'fitText'.

In order to avoid the cost of duplicating many times the sub-strings, the
functions involved do not place a NUL at the string-splitting position, but
they rely instead on giving the length of the string as a parameter.

The code that checks the Pango text (to avoid re-submitting the string when
not needed) did not use that length, so it would always keep the original
string that is too long, so the fitText function would always receive the
same result and loop forever trying to find where to split the string.

This patch adds the check on the length, so Pango is given the appropriate
string for its pixel size calculation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 15:33:46 +00:00
Christophe CURIS
f60f14b7bd WINGs: fix possible null pointer dereference in W_RealizeView (Coverity #50060)
As pointed by Coverity, the function makes use of a pointer which may be
null, so we have to properly check that to ensure application will not
crash.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
0c659c1618 WINGs: removed unnecessary size checks in WMGetBrowserPaths
The function is building strings from the directory names into an allocated
buffer, but the function took time first to calculate the exact size needed
for the resulting string, so the check on wstrlcat's result will never
fail.

As we still use wstrlcat it is not possible to overrun the buffer, we would
just return a truncated string in the list instead of return no list at all
but the case where it would happen is impossible.

This should fix Coverity #50111 (Resource leak) which was present in the
code of one of the related early return.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
082de93ca0 WINGs: inverted the direction for mouse wheel on WMSliders
The original choice may have looked mathematically correct, but it was
actually counter-intuitive and opposite to what every other application
do with sliders.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
01fbeab1d4 WUtil: fix default rights for file created when saving PropList
When creating the temporary file that will become the final file if no
problem occurs, there is a chmod done which does not give write access to
the group and to the others, but this is the task of the user-set umask.

This patch makes the rights to everything (except execution, of course) and
still applies the umask, so in the end the file will have the rights that
user wants.

Took the opportunity to make a little change related to the umask: it seems
that some version of mkstemp have a security issue, which is in not a
problem in our use case, but Coverity reports it (#50201) so as it does not
cost anything, the patch also fixes it with an appropriate comment to
explain the situation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
155e1f1fe1 WUtil: rewrote wcopy_file for better error handling and to fix Coverity #50234
The original code used the libc "fopen" kind of operation, which are handy
when manipulating text files, but:
 - bring an overhead for binary files that we don't need here;
 - does not provide the mechanisms for safe error handling and special cases

As Coverity reported a Time-of-Check/Time-of-Use type of security issue,
took the opportunity to fix it and increased the size of the buffer used
for data to allow better use of modern disk performances.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
662b83769a WUtil: changed order for null pointer check in array functions (Coverity #72806, #72807, #72819)
As pointed by Coverity, there were some null pointer checks that had been
misplaced, due to a pointer dereference present in a preceding check. This
had been fixed by adding another null check in the check, making a
duplicate check.

This patch moves the null pointer check in first place, and remove the
pointer check from the range check to separate the pointer check on one
side and the range check on the other side.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Alwin
40139e208b Catch-up and some cosmetic changes of the Dutch .po files
Catch-up and some cosmetic changes of the Dutch .po files

Recently added msgid's were translated, plus a few really minor
changes. Kept some entries for last stable release.
2014-11-23 22:42:18 +00:00
Doug Torrance
0acbec36ac WINGs: Link examples against Xlib.
The font lister WINGs example program was failing to build because it uses
the XOpenDisplay() function from Xlib.
2014-11-04 14:33:08 +00:00
Doug Torrance
4a2e202af8 WINGs: Avoid cast from pointer to integer of different size compiler warnings. 2014-11-02 13:14:54 +01:00
Doug Torrance
a47f07cfc3 WINGs: Fix unused parameter compiler warnings in examples. 2014-11-02 13:14:54 +01:00
Doug Torrance
fc35dfd277 WINGs: Fix decimal/hexadecimal conversion bug in color panel.
In particular, the values were only being converted when the RGB slider was used
to pick the color.  If another tool was used, e.g., the magnifying glass, th e
value was assumed to be decimal, even if hexadecimal was selected.
2014-11-02 13:14:54 +01:00
Khaled Hosny
e3dcadde30 WINGs: Add optional Pango text layout support
Currently WINGs renders text using Xft directly which does not support
any advanced text layout that is needed for scripts like Arabic or Indic
scripts (or even things like automatic ligature support for Latin
script).

With Pango we also get text fallback for free, so no more square boxes
for characters not supported in the current font (unless no font on the
system supports the specified character, of course).

This patch introduces support for using Pango to render the text (though
its Xft backed), to avoid forcing the additional dependency to everyone
it is made off by default.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 13:04:14 +01:00
David Maciejak
870a73ff32 WINGs: add function to get button caption
This patch is adding a new function WMGetButtonText to get the button caption.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 13:04:14 +01:00
Alwin
bec572ea8b Make two text strings translatable
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 12:50:02 +01:00
Alwin
a392c30b0d Catch-up and some improvements of the Dutch .po files
Recently added msgid's were translated, and some existing translations
improved. As development is done in git 'next', strings from wmaker-0.95.6
will be remained at the end of the files, so they are backward compatible.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 12:50:02 +01:00
David Maciejak
09761a75f0 WINGs: merge bagtree duplicate code
This patch is adding a new static function treeDeleteNode to factorize some code.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 12:50:02 +01:00
David Maciejak
2a3c11e202 WINGs: merge hashtable duplicate code
This patch is adding a new static function hashGetItem to factorize some code.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 12:50:02 +01:00
David Maciejak
238b8ed3ca WINGs: merge duplicate code from wtext
This patch is saving about 30 duplicate code lines from
WMPrependTextBlock and WMAppendTextBlock to create
a static fct called prepareTextBlock.
2014-08-24 02:27:30 +01:00
David Maciejak
c6c7652e24 wmaker: add miniwindow apercu
This patch is adding miniwindow apercu when the mouse
is over the miniwindows.

To enable it you have to run WPref, in Miscellaneous Ergonomic
Preferences, check miniwindow apercus.
Then, you will be able to see a screenshot of the app when the mouse
is over the miniwindow.
2014-08-20 11:52:01 +01:00
David Maciejak
39e1398257 WINGs: correct possible null pointer dereference
As reported by cppcheck:

[WINGs/array.c:129] -> [WINGs/array.c:131]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
[WINGs/array.c:151] -> [WINGs/array.c:153]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.
[WINGs/array.c:170] -> [WINGs/array.c:172]: (warning) Possible null pointer dereference: array - otherwise it is redundant to check it against null.

This patch is checking that the var name 'array' exists.
2014-07-27 09:45:38 -06:00
David Maciejak
f6b9fc8870 WINGs/Tests: make them compile again
This patch is adding the missing X11 libs reference.
2014-07-27 09:41:38 -06:00
Christophe CURIS
16045a6be4 Increment versions of libraries for next release due to public API Changes
WRaster:
- new function 'RShutdown'
- removed flag 'optimize_for_speed' from RContext
- new functions '...(operate_xxx)', '...(flip_image)'

WUtil:
- new function 'wutil_shutdown'
- new macro 'wlengthof'

WINGs:
- new function 'WMReleaseApplication'
- new function 'WMCreateScaledBlendedPixmapFromFile'

(And maybe a few more I missed)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-20 15:31:57 +01:00
Christophe CURIS
af059d408b WINGs: optimisations to 'WMReadPropListFromPipe'
The function did spend its time re-copying data and searching the
end of the read buffer, which is not really efficient.

The new code reads directly from file to the end of previous data,
avoiding unneccesary duplication, and keeps track of the end of
data to avoid searching it for next read.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Alwin
be5d04525d Catch-up with new strings, and overall improvements of the Dutch language files
Catch-up with new strings, and overall improvements of the Dutch language files
2014-06-21 00:13:10 +01:00
Christophe CURIS
ecbee34f3a Removed definitions of dangerous macro RETRY that does not work as expected
This macro supposes that the called lib function clears the 'errno'
variable on success which is not the case. The macro was (luckily) not
used in these file yet, by removing it we make sure it won't happen.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
David Maciejak
3b298e8964 WINGs: add function to set the color of the frame title
This patch adds a function used to set the color of the frame title
2014-06-15 19:45:20 +01:00
David Maciejak
db9f5c9658 WINGs: fix duplicate if/else branch in W_LookupString
cppcheck is reporting the msg below:

[../WINGs/winputmethod.c:215] -> [../WINGs/winputmethod.c:209]:
(style) Found duplicate branches for 'if' and 'else'.

The patch is fixing it by setting a default return call.
2014-05-28 16:04:02 +01:00
Doug Torrance
0121d78e54 WINGs: Click on colored portion of color well also opens color panel.
The color well contains two views: view, consisting of the outer "button", and
colorView, consisting of the color itself.  Previously, only clicking on view
would bring up the corresponding color panel, resulting in nonintuitive
behavior.
2014-05-19 15:12:14 +01:00
Christophe CURIS
ca9dd144ae WINGs: removed unnecessary gotos in handleTextKeyPress
When the condition can be simply checked in an if, it is better to do that
than to use a flow breaking goto.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
3a191af838 WINGs: fix probable crash in drag'n'drop (Coverity #50264)
As reported by Coverity, the structure containing the callback functions
to handle the drag-and-drop actions could be freed but later re-used.
The correct behaviour is to keep the allocated memory for the structure.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
7a39f32816 WINGs: fix possible NULL pointer dereference (Coverity #50197)
As pointed by Coverity, the 'paintItem' function in the WMBrowser widget
is checking for nullity of its text argument, but before that it called the
strlen function which crashes on NULL pointer. This patch moves the strlen
call to the right place and reduce the lifespan of 'textLen' to highlight
incorrect tries to use the variable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
28ce91a901 WINGs: fix check for NULL pointer in WMFilePanel (Coverity #50195)
As pointed by Coverity, there is a NULL pointer check at the end of the
function 'deleteFile' (which happens to not be necessary because wfree was
made to accept NULL pointers), however there are many things done before
that assumes the pointer is not NULL. The check is moved to where it
matters.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
e65f527ad4 WINGs: fix incorrect usage of direction variable in updateStartForCurrentTextBlock (Coverity #50192)
As pointed by Coverity, the variable 'dir' is passed by reference because
the function may update it; as it is never NULL (the function is local)
checking for that does not make sense. From the actual usage, it seems
logical that the check should have been on the value, not on the pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
21c891e669 WINGs: fix possible NULL pointer dereference in WMFreeColorPanel (Coverity #50189)
As pointed by Coverity, the code was checking for NULL pointer to avoid
misbehaviour, but it actually dereferenced the pointer beforehand so the
crash would still happen.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
354ec080ad WINGs: fix memory leak in requestHandler (Coverity #50136)
As pointed by Coverity, the allocated temporary storage was not freed. As
an allocation is not needed here, replaced by a local storage.
2014-05-18 23:01:43 +01:00
Christophe CURIS
482d8d3583 WINGs: fix memory leak in requestHandler (Coverity #50135)
As pointed by Coverity, the data returned by WMGetTextSelectedStream are
actually a newly allocated buffer, so we need to release it when we're done
with it.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
6831daf427 WINGs: fix memory leak in getStreamObjects (Coverity #50119)
As pointed by Coverity, the array used to build the result for the
function 'getStreamObjects' could leak in case of early return.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
0134720621 WINGs: fix memory leak in WMCreateTextForDocumentType (Coverity #50118)
As pointed by Coverity, a temporary WMArray was not freed after use.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00