1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00
Commit Graph

2925 Commits

Author SHA1 Message Date
Rodolfo García Peñas (kix)
727b25d947 Icon: Make icon_create_for_* be more similar
The contents for searching the icon in wAppIconCreateForDock()
are moved to icon_create_for_dock().

Now wAppIconCreateForDock() and wAppIconCreate() do the same work and
icon_create_for_dock() and icon_create_for_wwindow() do the same work too.

The procedure to create the icon is similar in both functions.

Now wAppIconCreateForDock, needs more arguments (command, instance and class).
2012-10-06 15:51:45 +01:00
Rodolfo García Peñas (kix)
97f74548ef wIcon* functions renamed
These functiosn were renamed:

wIconCreateCore to icon_create_core
wIconCreateWithIconFile to icon_create_for_dock
wIconCreate to icon_create_for_wwindow
2012-10-06 15:46:13 +01:00
Rodolfo García Peñas (kix)
adfb761021 wAppIconCreateForDockm, changed variable WAppIcon name
The variable "dicon" is now named "aicon", the same name that
the WAppIcon variable used in wAppIconCreate.

Some clean code more, like spaces in function arguments.
2012-10-06 15:46:03 +01:00
Rodolfo García Peñas (kix)
ff49393bfa Remove call to wIconUpdate() from wAppIconCreate()
Remove the call to wIconUpdate() in wAppIconCreate() and place it in
makeAppIconFor() since wAppIconCreate() is only used in that function
and icon update or icon painting is not icon creation.

Now the function wAppIconCreate() only creates the app_icon.
2012-10-06 15:44:57 +01:00
Rodolfo García Peñas (kix)
236c1c5f70 wIconCreate: get the icon file name first
The function wIconCreate search the icon image calling wDefaultGetIconFile.
wDefaultGetIconFile search first the icon file name and then search the
image using the icon file name. wDefaultGetIconFile returns the icon image
to wIconCreate, then wIconCreate search the file name (again).

Is better that wIconCreate search first the file name, and then get
the image using the file name.
2012-10-06 15:37:58 +01:00
Rodolfo García Peñas (kix)
da5e2f8a0d Icon: Replace code by call to helper function in wIconCreateWithIconFile
Code in the function wIconCreateWithIconFile does the same task as
get_default_icon_rimage(), therefore replace it with a call to that
function.

It is the code to get the image file (rimage) using the file name.
2012-10-06 15:32:29 +01:00
Rodolfo García Peñas (kix)
e988386013 Removed block in restore_icon_state
The block inside restore_icon_state is not needed, so can be removed.

There are no changes with or without the block (variables scope,...).
2012-10-06 15:29:58 +01:00
Rodolfo García Peñas (kix)
a089647d27 Coding style cleanup in dock.c
This patch reviews the code style in dock.c, removing some
curly brackets not needed and adding other where needed.

This patch removes some lines commented and some extra lines for
better understanding.
2012-10-06 15:25:10 +01:00
Rodolfo García Peñas (kix)
3c7ca36d5b Code style cleanup in framewin.c
This patch reviews the code style in framewin.c, removing some
curly brackets not needed.

This patch also removes some commented-out lines.
2012-10-06 15:23:26 +01:00
Iain Patterson
5c0b851cc6 Remove _NET_FRAME_EXTENTS on shutdown.
After we exit there are no window decorations therefore frame extents
are meaningless.

We could be left with parts of the window being the wrong opacity if the
property is left intact and a compositing manager configured to draw
decorations with a different opacity to the rest of the window is still
running.

Remove the _NET_FRAME_EXTENTS property from all windows when we shut
down to prevent windows from being drawn incorrectly after we're gone.
2012-09-16 13:01:23 +02:00
Rodolfo García Peñas (kix)
0e995bbf6e Debian 0.95.3-20120909-1 version
This is not a final version, is only a version for developers.

This version includes compatibility with debconf 9.
This version will be modified to change the libwutil2 symbols
to a new upstream version, probably 0.95.4.
2012-09-10 11:00:09 +02:00
Iain Patterson
5d8dfa4764 Fixed invalid argument to popen in readMenuPipe().
We were passing "rb" to popen(), which was failing with EINVAL with the
result that generated menus were not displayed.
2012-08-25 11:00:09 +01:00
Iain Patterson
b796928504 Draw window borders with correct colormap.
Using window-supplied depth, visual and colormap information has the
side effect of causing window borders to be draw using inconsistent
colormap entries.  Allocate entries from each window's colormap when
drawing its border.

Force setting the border when the window is first created so it's
guaranteed to be drawn in a consistent state.
2012-08-25 11:00:01 +01:00
Iain Patterson
9ab2b642a6 _NET_FRAME_EXTENTS fixes.
Recalculate frame extents when the titlebar, resize bar or border are
enabled/disabled.

Account for border when calculating top and bottom frame extents.

Quoth I,

> I've just seen that _NET_FRAME_EXTENTS isn't updated when
> disabling or enabling the titlebar, resizebar and border of a window,
> so that needs to be fixed.

  The attached patch fixes _NET_FRAME_EXTENTS not updating when using
the inspector to disable or enable the titlebar, resizebar or border.
It also fixes not taking the border width into account when
calculating the top and bottom extents.

  With the patch the window's border is drawn for 32bpp urxvt windows
with compton.  The border still isn't black, however.  That's because
the border is taken from the screen's colormap rather than the
window's.  I'll have a fix for that soon.
2012-08-24 22:05:44 +01:00
Iain Patterson
39a5f3da0b Allow windows to specify their own depth.
Accept windows' depth, visual and colormap instead of always using those
of the root window.  Internal windows such as menus behave as before.

In conjunction with a compositing manager on a display supporting the
RENDER extension windows can now manage their own opacity.

I wrote the patch after reading the FAQ for urxvt, which says,
regarding transparency support:

"3. Use an ARGB visual:

  urxvt -depth 32 -fg grey90 -bg rgba:0000/0000/4444/cccc

This requires XFT support, and the support of your X-server. If that
doesn't work for you, blame Xorg and Keith Packard. ARGB visuals
aren't there yet, no matter what they claim. Rxvt-Unicode contains the
necessary bugfixes and workarounds for Xft and Xlib to make it work,
but that doesn't mean that your WM has the required kludges in place."

  In conjunction with a compositing manager (I tested compton) it does
work and urxvt draws a semi-transparent background with fully opaque
foreground text and scrollbars; much prettier than applying a blanket
transparency value over the whole window with the compositing manager.
Other application windows I tested were, as expected, drawn the same
as before.

  I verified that urxvt is drawn in the same way when using xfwm4
(with builtin compositing).  Since Window Maker doesn't (at time of
writing) have its own compositing manager I should clarify that one is
required to see any benefit from this patch.

  Whether or not this feature is useful for any application other than
urxvt I don't know, though I assume that an application which chose an
ARGB visual in the same way would be able to draw itself prettily.

  On a display without RENDER things work just as they do without the
patch.  I have, however, only been able to test on a fairly standard
TrueColor display supporting multiple colour depths with 24bpp being
the default.  Testing with more ... exotic ... display types would
probably be advisable.
2012-08-22 00:24:41 +01:00
Rodolfo García Peñas (kix)
5fe4160025 menuparser.c code clean
This patch do this changes:

1. Change (add/remove) blank lines
2. Join some if's in only one
3. Change c++ comments to c comments (// -> /* */)
4. Add / remove curly brackets if needed
5. Change spaces (add/remove) & set correct indentation
2012-07-28 18:39:40 +01:00
Christophe CURIS
b2e7620868 Menu parser: remove d-quotes around title of entry
When a menu entry contains a space, it is necessary to enclose it
in simple or double quotes; these were not removed and so would
appear in the menu.
2012-07-19 11:23:29 +01:00
Christophe CURIS
9ad278ddf8 Menu parser: added boundary checks in the path-gen for #include file search
When generating the full path+name of file to search for a file
being #included, it was generated in a buffer that's supposedly
large enough (MAXLINE > 2*PATH_MAX). However, this limit has a few
issues (PATH_MAX seem to be able to be bigger, and worse: we can't
be sure we're given longer args).

The code was rewrote to natively include boundary checks so we're
sure we won't overflow the buffer. A few strncpy have been removed
because in this case they tend to make things harder to write.
2012-07-19 11:23:29 +01:00
Christophe CURIS
ac52d4de65 Menu parser: fix possible infinite loop when loading menu file
When a #include is used, the file is searched in many places; when
the file was searched in the ':'-separated list of path it could
led to infinite loop if the list contained more than one path and
that the file was not found in the first path, the ':' separator
was not properly passed over.
2012-07-19 11:23:29 +01:00
Christophe CURIS
9f694b66b5 Fixed warning in Debian's wrapper script for wmaker
The Debian script for WindowMaker generates some warnings on startup
due to 'find' being cautious about its options, updated them to be
in line with expectations.
2012-07-19 11:23:11 +01:00
Rodolfo García Peñas (kix)
1fb452ea95 Remove dup code in wAppIconCreateForDock
Some code in wAppIconCreateForDock() is duplicated with the function
get_default_icon_filename(). It can be removed.
2012-07-18 11:15:31 +01:00
Rodolfo García Peñas (kix)
bef6555b6a noDefault changed to default_icon
The functions wDefaultGetIconFile(), get_default_icon_filename() and
get_generic_value() use the argument noDefault in order to avoid searching the
default icon. This double negation is difficult to read though. This patch
changes it to be True if the default icon should be included or false if not.

This patch changes the noDefault argument to default_icon, then the
True is now False and False is True.

The main change is at get_generic_value():

-       /* Search the default icon name - See noDefault argument! */
-       if (!value && !noDefault) {
+       /* Search the default icon name - See default_icon argument! */
+       if (!value && default_icon) {

Because the functions wDefaultGetIconFile() and get_default_icon_filename()
mainly forwards the noDefault argument to get_generic_value().
2012-07-18 11:12:01 +01:00
Rodolfo García Peñas (kix)
fae81bf518 Format string bug in WMenuParserError
There is a format string (FS) bug in the function WMenuParserError.

It is the tipical FS bug, like printf(a) instead of printf("%s", a);

See http://en.wikipedia.org/wiki/Uncontrolled_format_string for more info.
2012-07-16 22:45:25 +01:00
Rodolfo García Peñas (kix)
448a68c6d2 get_wwindow_image_from_x11 icon resize
The icon size should be set when the icon is created. Therefore the icon size
for net_icon_image should be set at get_wwindow_image_from_x11(), function that
creates the image.
2012-07-16 02:06:36 +02:00
Rodolfo García Peñas (kix)
af41673dbf Removed scaleDownIfNeeded function (dup code)
The function scaleDownIfNeeded's code is duplicated with the code of
wIconValidateIconSize(), then this function can be removed. The icon
size in the switchpanel should be ~48 pixels, to allow the frame around
the icon. Then, we always should resize the icon to this size. The standard
icon size is specified in WPreferences.icon_size (usually 64 pixels).
2012-07-16 02:06:36 +02:00
Rodolfo García Peñas (kix)
2e7b7b7e02 Removed WScreen argument in wIconValidateIconSize
This patch removes the argument WScreen in wIconValidateIconSize,
because is not used.
2012-07-16 02:06:36 +02:00
Christophe CURIS
35a2ed24ec Fixed wrong re-generation of 'config-paths.h' file
There was a slight error in the generation of this this which led
it to grow in size everytime the Makefile is regenerated.
2012-07-16 02:06:25 +02:00
Christophe CURIS
bb0c1f3035 Small cleanup in Git's ignore file 2012-07-15 18:50:39 +02:00
Christophe CURIS
9e86868373 Added some comments and spaces in Git's ignore file
It helps to understand why a file is present in this file, which
in turn can help to understand where a file comes from and it makes
updates to the file easier
2012-07-15 18:50:39 +02:00
Rodolfo García Peñas (kix)
fccde3b7e6 Better icon scale
The icons should be scaled if their size is "max_size - ~3 pixels".
Tipically, max_size is 64 pixels. With the current wIconValidateIconSize
the max size for an icon is "64 pixels", then the icon don't have border
and is ugly. This problem is in the dock icons and in the switchpanel.

The new wIconValidateIconSize function don't use the fixel value of 64
pixels, uses the argument max_size to get the final icon size. The icon
is scaled holding the aspect ratio and reserve ~2 or ~3 pixels to hold
left space to the icon border. Now the icon is inside the icon space,
with border.

This patch removes the preprocessor option of DONT_SCALE_ICONS, because
all the icons should be scaled if needed, to hold a beatiful interface.
2012-07-15 16:29:57 +02:00
Rodolfo García Peñas (kix)
44c9ee694d switchpanel default icon removed
The default icon (defIcon) is never used because the function wDefaultGetImage
always returns a icon (it searches the default icon). So we can remove the
defIcon variable, its creation and remove code.
2012-07-15 16:28:02 +02:00
Rodolfo García Peñas (kix)
829830c010 New function create_default_icon
The function create_default_icon sets the panel's default icon. This
is interesting to have a "cache" icon and don't search the default
icon more than one time if the icons don't have icon associated.

The code of create_default_icon was included in the addIconForWindow()
function, this patch only moves it to get a better (clear) code.
2012-07-15 16:23:54 +02:00
Rodolfo García Peñas (kix)
6d08aa22d8 switchpanel.c code clean
Some code clean in the file switchpanel.c, like spaces, curly brackets,
tabs, join ifs,...
2012-07-15 16:22:19 +02:00
Rodolfo García Peñas (kix)
43c3526d21 WPrefs: XKeycodeToKeysym deprecated function
The function XKeycodeToKeysym is deprecated and should be replaced
by XkbKeycodeToKeysym.
2012-07-15 13:34:37 +02:00
Christophe CURIS
139f912e61 Remove dependency to CPP: removed stuff related to CPP calls
Now that the built-in parser has support for all the feature of CPP
being used by WindowMaker's default menu, we can remove the stuff
related to calling CPP:
 - code for preparing and running CPP;
 - compile-time option to de-activate the call to CPP;
 - command-line option
2012-07-14 20:22:21 +02:00
Christophe CURIS
4658f4f9a1 Remove dependency to CPP: add support for conditional directives
It is now possible to use #ifdef/#ifndef to exclude some part of the
file. The implementation uses a stack to track conditionals so it is
possible to use nested constructs.
2012-07-14 20:22:20 +02:00
Christophe CURIS
9b792369cb Remove dependency to CPP: added pre-defined macros
A number of macros are pre-defined by WindowMaker for CPP in the
function 'MakeCPPArgs', they are now available in the internal
parser too. CPP also had some predefined macros, a subset of them
have been added.
The definition have been split in two parts:
 - the macro that are dependant on WindowMaker parameters are
defined by WindowMaker (src/rootmenu.c)
 - those that are independant, which can be defined by the parser
itself (WINGs/menuparser_macros.c)
2012-07-14 20:22:20 +02:00
Christophe CURIS
aaa4517df7 Remove dependency to CPP: support for #define macros
This adds support for defining new macros, with or without parameters, which
when found afterwards in the text are replaced by their definition.
The complex analysis for arguments replacement is done at macro definition
time, so it is done only once and the macro expansion will be fast.
The macro-related functions have been placed in their own file because it is
quite a complex task and we do not want filesize to explode, it is always
better to keep things human-sized.
2012-07-14 20:22:20 +02:00
Christophe CURIS
88a82ab8df Remove dependency to CPP: support for #include directive
The parser is prepared to handle '#' directives, starting with file
inclusion. The search path for the file are taken from what was
actually given to CPP. There is an arbitrary limit to the inclusion
nesting, which is actually not a design limitation but a security
to avoid infinite include loops.
2012-07-14 20:22:20 +02:00
Christophe CURIS
ed9482b626 Remove dependency to CPP: new parser that handles comments
Wrote a new parsing code that is able to skip over comments.
Note that because CPP is still active, you will not see any
effect unless you disable CPP pre-processing.
2012-07-14 20:22:20 +02:00
Christophe CURIS
7d74648fc3 Remove dependency to CPP: add function to report problems while parsing
The default function used so far provides informations not so useful
to user, like wmaker's source file, line number and function; it
also cannot provide the line number from the parsed file because cpp
messes this information.

With this dedicated function we try to provide useful things which
are being tracked by the parser internally, like valid line number
and the name of the file being read (which can be convenient in the
case of #include, for which we may also be able to provide the
inclusion tree!)
2012-07-14 20:22:20 +02:00
Christophe CURIS
42cccb2313 Remove dependency to CPP: merged 'getLine' and 'separateline' into a single function call
From caller point of view, the two function have been merged into a
single function in the API. This will be needed by the advanced
parser that will have to not separate the concept of a 'line' and
the concept of 'content' (due to empty/comment lines, multi-line
comments, long lines split with '\')
2012-07-14 20:22:20 +02:00
Christophe CURIS
19f0998cd1 Remove dependency to CPP: create structure to keep info of file being parsed
All the information related to the file being parsed are stored in
a single place. The content of this structure is not visible to
caller to avoid messing the content; the parsing will be handled as
methods to this object.

Please note that all functions visible as part of the parser's API
are using the CamelCaseNotation to be consistent with the rest of
the API; however all internal functions use the non_camel_case_syntax
to follow the coding style set by Carlos for the project.
2012-07-14 20:22:20 +02:00
Christophe CURIS
f0e8b76c03 Remove dependency to CPP: Moving parser functions to a dedicated file
Due to the tasks to take in charge, the internal parser will grow in
size to support basic CPP feature, so it is a good idea to start by
moving the current functions into a dedicated file.
2012-07-14 20:22:20 +02:00
Rodolfo García Peñas (kix)
39fa6d9e2c Remove dup code from getWindowMakerIconImage()
The code to find the icon in the function getWindowMakerIconImage()
is duplicated, because it is the same code as in get_default_icon_filename()

This patch includes the prototypes of get_default_icon_filename()
and get_default_icon_rimage() in defaults.h, so these functions
can be used in other files.
2012-07-04 21:20:18 +02:00
Rodolfo García Peñas (kix)
76e8a8f963 wDefaultGetImage splitted
The function wDefaultGetImage() is splitted in two:

1. get_default_icon_filename(): This function returns the full
   path of an icon. The function searches the icon in the database
   using instance and class.
2. get_default_icon_rimage(): This function returns the RImage for
   a given image path (full path). This function validates the icon
   size, so the icon is fully usable.

The function get_default_icon_filename() now adds the .app icons in the
search (using wApplicationExtractDirPackIcon()). To do it, the command
should be included, because this function searches '"command".app' icons.
Setting the command to NULL, this case is not used.

To do it we need the function wApplicationExtractDirPackIcon() defined
at appicon.c, so we need set the function as non-static and provide their
prototype in appicon.h.

This patch also includes an extra pointer check at wDefaultGetStartWorkspace
to make sure that WDWindowAttributes exists.
2012-07-04 21:13:54 +02:00
Rodolfo García Peñas (kix)
f5d845cfad Remove unused argument from wDefaultFillAttributes()
The function wDefaultFillAttributes() doesn't use the argument WScreen,
so it can be removed.
2012-07-04 20:45:56 +02:00
Rodolfo García Peñas (kix)
d6db53af0b Remove unused argument from wDefaultGetIconFile()
The function wDefaultGetIconFile() doesn't use the argument WScreen,
so it can be removed.
2012-07-04 20:44:40 +02:00
Rodolfo García Peñas (kix)
fd07a6bb36 Remove unused argument from init_wdefaults()
The function init_wdefaults() doesn't use the argument WScreen,
so it can be removed.
2012-07-04 20:42:40 +02:00
Iain Patterson
347d6f9fda Support _NET_FRAME_EXTENTS.
This patch adds support for the _NET_FRAME_EXTENTS property as
described in the EWMH spec.  With it I was able to use the compton
compositing manager to draw fully opaque windows with semi-transparent
titlebars and resizebars.

Set the _NET_FRAME_EXTENTS property based on border widths and
titlebar/resizebar heights.

The EWMH spec says:

"_NET_FRAME_EXTENTS, left, right, top, bottom, CARDINAL[4]/32

The Window Manager MUST set _NET_FRAME_EXTENTS to the extents of the
window's frame.  left, right, top and bottom are widths of the
respective borders added by the Window Manager."
2012-07-04 20:38:51 +02:00