[PATCH] debian: Added the debian revision to changelog

2012-02-17 Thread kix
Debian revision was forgotten in the last debian commit.
---
 debian/changelog |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3cd8a59..72dab3c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-wmaker (0.95.2) unstable; urgency=low
+wmaker (0.95.2-1) unstable; urgency=low
 
   * New upstream version 0.95.2 [Closes: #69669, #486542, #270877]
 [Closes: #283240, #48550, #297019, #108432, #72917]
-- 
1.7.8.3

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Re : Re : Re: Help. Quick test with the current next binary

2012-05-31 Thread Kix
I will try it later. I dont have my laptop here. Sorry.
-- 
Enviado desde mi teléfono Android con K-9 Mail. Disculpa mi brevedad

Christophe  escribió:

Hi Carlos,

While we're at it, could I propose the attached patch instead? It does the same 
thing and a few more I did not search for the first time.

Regards,
Christophe.


- Christophe  a écrit :
> Hi Rodolfo,
> 
> Could you please have a try at the patch attached below? it may (or may not) 
> solve the problem.
> 
> 
> Carlos,
> 
> Considering the nature of the patch, I'd suggest to include it anyway if its 
> fits your standards.
> 
> Regards,
> Christophe.
> 
> 
> 
> - Rodolfo kix Garcia  a écrit :
> > El 31.05.2012 18:33, Carlos R. Mafra escribió:
> > > On Thu, 31 May 2012 at 18:03:10 +0200, Rodolfo kix Garcia wrote:
> > >> El 31.05.2012 17:54, Carlos R. Mafra escribió:
> > >> >On Thu, 31 May 2012 at 17:20:30 +0200, Rodolfo kix Garcia wrote:
> > >> >>Hi,
> > >> >>
> > >> >>please, can anyone using the current next brach (updated) to check
> > >> >>if there is a bug?
> > >> >>
> > >> >>1. Launch any application
> > >> >>2. Open the properties
> > >> >>3. Click on "Reload"
> > >> >>
> > >> >>I didn't have this problem with the debian binary, but yes with my
> > >> >>developer binary at /usr/local/bin.
> > >> >
> > >> >I don't see any obvious problem with clicking the "Reload" button
> > >> >here.
> > >> >What kind of problem do you see?
> > >>
> > >> Hi Carlos,
> > >>
> > >> thanks for your reply. wmaker restarts, this is the problem:
> > >>
> > >> Program received signal SIGSEGV, Segmentation fault.
> > >
> > > Ok, I definitely can't trigger it. Can you (git) bisect this?
> > 
> > Hi Carlos,
> > 
> > I think the problem is at commit 
> > c82138eab959bc4f73b5c49de209188aab25b2a0 (Haroldo Santos's patch, in 
> > cc:).
> > (http://repo.or.cz/w/wmaker-crm.git/commitdiff/c82138eab959bc4f73b5c49de209188aab25b2a0)
> > 
> > The previous commit (wmgenmenu: Add French and Spanish translations) 
> > don't have the problem.
> > 
> > I have not time now to make a patch. I will try to check it soon (but 
> > not today), because I spent a lot of time trying to see if my new 
> > patches has bugs. If you (or Haroldo) can check it, perfect. I am busy 
> > these days :-(
> > 
> > Regards.
> > kix
> > -- 
> > ||// //\\// Rodolfo "kix" Garcia
> > ||\\// //\\ http://www.kix.es/
> > 
> > 
> > --
> > To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
> 



Re: [PATCH 0/7] Remove dependency to CPP

2012-07-02 Thread kix

El 2012-07-01 20:41, Christophe escribió:

Hello All,

The goal of these 7 patches is to remove the dependency to CPP which
is currently used to pre-process the menu definition file.

The main reasons we'd wish to do this is:
 - most users don't do dev, so the distributions do not install GCC
by default, so we're adding them a strong dependency;
 - not all C compilers actually provides a CPP now, the example being
the rising CLANG (from LLVM) which has valuable reasons to do so.

Because the default menu provided by WindowMaker does need these
features, we cannot simply get rid of the code, or we'd break
compatibility with our user base.
Although this means some added complexity in WindowMaker, because
this is likely to improve performances:
 - no more sub-process to call external CPP program;
 - less 'wmalloc/wfree' calls which are expensive (both in term of
performance and memory fragmentation) than in original code.

The first patch is a preparation for the new parser into a dedicated
file; the patches 2 to 6 add support for features of the parser and
patch 7 concludes by removing code calling CPP. That means that no
patch should break anything.

Best Regards,
Christophe.


Hi,

your patch don't apply

I got an error about rootmenu.h:41.

What branch did you use? What was the last commit?

Best Regards,
kix

--
Rodolfo García Peñas (kix)
http://www.kix.es


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 0/7] Remove dependency to CPP

2012-07-02 Thread kix

El 2012-07-01 20:41, Christophe escribió:

Hello All,

The goal of these 7 patches is to remove the dependency to CPP which
is currently used to pre-process the menu definition file.

The main reasons we'd wish to do this is:
 - most users don't do dev, so the distributions do not install GCC
by default, so we're adding them a strong dependency;
 - not all C compilers actually provides a CPP now, the example being
the rising CLANG (from LLVM) which has valuable reasons to do so.

Because the default menu provided by WindowMaker does need these
features, we cannot simply get rid of the code, or we'd break
compatibility with our user base.
Although this means some added complexity in WindowMaker, because
this is likely to improve performances:
 - no more sub-process to call external CPP program;
 - less 'wmalloc/wfree' calls which are expensive (both in term of
performance and memory fragmentation) than in original code.

The first patch is a preparation for the new parser into a dedicated
file; the patches 2 to 6 add support for features of the parser and
patch 7 concludes by removing code calling CPP. That means that no
patch should break anything.

Best Regards,
Christophe.


Hi,

your patch don't apply :-(

I got an error about rootmenu.h:41.

What branch did you use? What was the last commit?

Best Regards,
kix


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 1/7 v2] Moving parser functions to a dedicated file

2012-07-03 Thread kix

El 2012-07-02 20:05, Christophe escribió:




Hi Christophe,

probably I am new reviewing patches, but... this patch is so big. I 
cannot understand what you did.
You are changing the function names, moving functions with other names 
to other files, adding arguments to functions, changing types,... all 
together in the same patch. For me is too difficult.


Please, wait the Carlos's or other developers reply before split this 
patch. I don't want to make you work more.


Best Regards,
kix
--
Rodolfo García Peñas (kix)
http://www.kix.es


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: wmpager: tooltip or not tooltip?

2012-08-23 Thread kix

On 2012-08-22 00:17, Alexey I. Froloff wrote:

On Tue, Aug 21, 2012 at 09:31:19PM +0200, Rodolfo kix Garcia wrote:
IMO, is better have a wmpager (with or without tooltips) than don't 
have
nothing. Perhaps, you can hold the tooltips without utf-8 in the 
pager.

OK.


Probably we should think about something like "libdockapps", a
shared library with shared code used in dockapps.

You'd be laughing, but yes, there is such library -
http://freecode.com/projects/libdockapp, but upstream site is
dead now.  I'll add it to dockapps repository later.


I saw this library some time ago, but I didn't see the code. I don't 
know if the library is to make the "visual" part of the icon. Perhaps 
the tooltip code should be included in this (or other similar/new) 
library. I am thinking in the other code too, the code to check the CPU, 
memory, mail,... There are many dockapps with the same purpose. For 
example, to check the mail: wmbiff, wmmail, wmnotify,... CPU? wmcpu, 
wmmon, wmcpumon, wmprocessor,... and probably the code to check the 
mail, the memory,... is similar. This code could be in a library?



But there's another thing.  I've packaged several dockapps in
Fedora, and this all-in-one repo creates several problems (you
may look at
http://pkgs.fedoraproject.org/cgit/wmmon.git/tree/wmmon.spec to
see how the tarball was made and what it looks like).

Since most of the dockapps was updated, we should tag everything,
create separate tarballs for each dockapp and upload these
tarballs somewhere near wmaker.


Yes, and no :-) I have some dockapps too for Debian, and I have 
problems because:


1. dockapps are in the same repo, therefore I cannot use the tools to 
create packages from git easily (or I don't know how to use it (and I 
don't have more time))
2. dockapps in the repo don't have upstream changelog (or it is not 
updated) and we don't have versions in dockapps (only the git revision).


I create the debian packages using git clone + tar (gz) the dockapp. 
Because there are not many changes in the dockapps repository, 1 is not 
a real problem for me. Indeed, I prefer use only one repository, to have 
all the dockapps together. We are moving the upstream of some dockapps 
to our repository and for me that is great. We are recovering dockapps.
The problem with the changelog, is not a real problem too. If 
wmaker-dev is the upstream now, we can create a changelog file and fill 
it with the info (normally this info is in the .c file of the dockapp). 
About changelogs and repository, we had some mails in the wmaker-dev 
mail list and I don't want to reopen it again, because it don't matter 
for this mail.


BUT, I agree with you about the tarball files. If we have tarballs, is 
easy for us control the dockapps packages. The solution probably is 
easy. We can do an script that every night check the repository. Because 
every dockapp is in a different folder, if one folder has changes, then 
the script should create a new tarball file for this dockapp. The file 
name could be "folder" + "_" + date. Something like:


wmbutton_20120823.tar.gz

The .tar.gz files should be uploaded to a different place, probably in 
the http://windowmaker.org/folder. Only dockapps with changes should be 
created + uploaded, then we have the last version of the dockapps, with 
the date of the last change.


Is only my opinion.

Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


debian: wmfire removed

2012-08-31 Thread kix

Hi,

wmfire dockapp was removed from the debian distro.

http://packages.qa.debian.org/w/wmfire.html

Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Fwd: [Bug 1030022] Re: Port from legacy Xlib to to modern XCB

2012-09-27 Thread kix

Hi,

fyi. What should we do?

Regards,
kix

 Original Message 
Subject: [Bug 1030022] Re: Port from legacy Xlib to to modern XCB
Date: 2012-09-28 06:49
From: Ronny Cardona <1030...@bugs.launchpad.net>
To: k...@kix.es
Reply-To: Bug 1030022 <1030...@bugs.launchpad.net>

Hello,

Spectrwm has moved from Xlib to XCB in upstream. Debian Maintainer is a
little busy right now and will update it as soon as he can.

I think that Spectrwm 2.X (XCB version) will not reach Quantal Quetzal,
but I'm thinking to keep it updated in my PPA (or request a merge for
it).

--
You received this bug notification because you are subscribed to wmaker
in Ubuntu.
https://bugs.launchpad.net/bugs/1030022

Title:
  Port from legacy Xlib to to modern XCB

Status in Compiz:
  Triaged
Status in “9wm” package in Ubuntu:
  New
Status in “aewm” package in Ubuntu:
  New
Status in “aewm++” package in Ubuntu:
  New
Status in “afterstep” package in Ubuntu:
  New
Status in “amiwm” package in Ubuntu:
  New
Status in “blackbox” package in Ubuntu:
  New
Status in “clutter” package in Ubuntu:
  New
Status in “compiz” package in Ubuntu:
  Triaged
Status in “ctwm” package in Ubuntu:
  New
Status in “dvtm” package in Ubuntu:
  New
Status in “dwm” package in Ubuntu:
  New
Status in “enlightenment” package in Ubuntu:
  New
Status in “evilwm” package in Ubuntu:
  New
Status in “flwm” package in Ubuntu:
  New
Status in “fvwm” package in Ubuntu:
  New
Status in “fvwm1” package in Ubuntu:
  New
Status in “herbstluftwm” package in Ubuntu:
  Opinion
Status in “icewm” package in Ubuntu:
  New
Status in “jwm” package in Ubuntu:
  New
Status in “larswm” package in Ubuntu:
  New
Status in “libcairo” package in Ubuntu:
  New
Status in “lwm” package in Ubuntu:
  New
Status in “matchbox-window-manager” package in Ubuntu:
  New
Status in “metacity” package in Ubuntu:
  New
Status in “miwm” package in Ubuntu:
  New
Status in “notion” package in Ubuntu:
  New
Status in “openbox” package in Ubuntu:
  New
Status in “pekwm” package in Ubuntu:
  New
Status in “ratpoison” package in Ubuntu:
  New
Status in “sapphire” package in Ubuntu:
  New
Status in “sawfish” package in Ubuntu:
  New
Status in “spectrwm” package in Ubuntu:
  New
Status in “subtle” package in Ubuntu:
  Invalid
Status in “tinywm” package in Ubuntu:
  New
Status in “tritium” package in Ubuntu:
  New
Status in “twm” package in Ubuntu:
  New
Status in “vtwm” package in Ubuntu:
  New
Status in “w9wm” package in Ubuntu:
  New
Status in “windowlab” package in Ubuntu:
  New
Status in “wm2” package in Ubuntu:
  New
Status in “wmaker” package in Ubuntu:
  New
Status in “wmii” package in Ubuntu:
  New
Status in “xmonad” package in Ubuntu:
  New

Bug description:
  Port/rewrite the window manager to use the modern XCB (X C Binding)
  library instead of the old legacy Xlib.

To manage notifications about this bug go to:
https://bugs.launchpad.net/compiz/+bug/1030022/+subscriptions

--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Fwd: Work-needing packages report for Sep 28, 2012

2012-09-27 Thread kix

Hi,

three packages more orphaned in debian :-(

Regards,
kix

 Original Message 
Subject: Work-needing packages report for Sep 28, 2012
Date: 2012-09-28 02:25
From: w...@debian.org
To: debian-de...@lists.debian.org

The following is a listing of packages for which help has been 
requested

through the WNPP (Work-Needing and Prospective Packages) system in the
last week.

Total number of orphaned packages: 470 (new: 22)
Total number of packages offered up for adoption: 137 (new: 0)
Total number of packages requested help for: 66 (new: 0)

Please refer to http://www.debian.org/devel/wnpp/ for more information.



The following packages have been orphaned:

[snip]
   wmacpi (#688533), orphaned 4 days ago
 Description: ACPI battery monitor for WindowMaker
 Installations reported by Popcon: 150

   wmbatppc (#688553), orphaned 4 days ago
 Description: Battery monitor for Apple G3/G4 ibooks/powerbooks
 Installations reported by Popcon: 10

   wmclock (#688534), orphaned 4 days ago
 Description: dockable clock applet for Window Maker
 Installations reported by Popcon: 227

[snip]
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


BTS

2012-10-03 Thread kix

Hi!

I created a bug tracker at http://www.kix.es/mantis (secure at
https://www.kix.es/mantis) to manage the wmaker bugs.

I know that John is busy and IMO is better use http://windowmaker.org/ 
for this pourpose, but

we can use this now as alternative.

If in the futere John installs Mantis BTS I will export the registered 
bugs and move

them to windowmaker.org.

Regards,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Question about dockit

2012-10-04 Thread kix

Hi,

yesterday I was checking some code and I found some lines talking about 
"dockit". I didn't use this application (or I don't remember). Trying to 
find more info I found this:


https://build.opensuse.org/package/view_file?file=WindowMaker-config.patch&package=WindowMaker&project=openSUSE%3A12.2&rev=7b8918f0c3ad16bfa6c7e565b521754a

Is a patch for SuSe.

Is somebody using dockit?
Is useful?
Should we include it in the upstream?

There are some code blocks talking about it, because dockit don't 
update WMState to indicate that the application is docked (by force).


Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Re : Bug in dock image change?

2012-10-09 Thread kix

On 2012-10-09 00:27, Christophe wrote:

Hi Kix,

If you have a look at your BTS (which is a good idea if you ask me),
you'll see that I could reproduce the bug on my side! So I've done a
patch to solve the problem.

Regards,
Christophe.



Hi Christophe,

thanks a lot for your help :-) I was working in the icon part and I 
prefer to post the bug instead investigate it.


I tested your patch and is ok here. Good job.

Thanks.


- Rodolfo García Peñas  a écrit :

Hi,

I wrote a lot of lines and I have a doubt about one bug. I think 
that there is a bug in wmaker:


1. Open the Settings box, for example for WMDock. (Right click on 
WMDock, Settings).
2. In the "Icon Image" field, write some characters. For example 
"asdfasdfasd".
3. Click in "OK". You get "Could not open specified icon file: 
GNUstep.tiffasdfasdfasd"

4. Hit in "OK"
5. Repeat 2,3,4 some times (sometimes 1, sometimes 2, sometimes 10).

Here, windowmaker crash. More people with this problem?

Thanks,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to 
wmaker-dev-unsubscr...@lists.windowmaker.org.


--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Re : Re: 0000002: Functions malloc and free used

2012-10-09 Thread kix

On 2012-10-09 00:51, Christophe wrote:

Hi,

If you'd allow me, I'd like to say this about this: (take it for what
its worth)

- Rodolfo García Peñas  a écrit :

On Sat, 06 Oct 2012, Carlos R. Mafra escribió:

> On Sat,  6 Oct 2012 at 12:22:26 +0200, Rodolfo García Peñas wrote:
> >
> > Some functions malloc an free are used.
> > These functions should be replaced (always?) by wmalloc and 
wfree.

>
> Why do you think they should be replaced?

Hi Carlos,

This is the function wfree:

[...]

It checks if the pointer exists, then free it and set it to NULL. 
IMO is better to avoid free a NULL pointer and get a crash with double 
free memory error.


About wmalloc:

[...]

Is better because:

1. If memory is not available, sleep and retry -> No crash.


Unfortunately, it retries only once, and after a too short time to
realistically expect some memory to have been freed, so it is likely
that it will "crash" anyway.


2. If no memory is available at all, then do a "order" exit -> No 
crash.


There are many discussion that highlight that this is a bad behaviour
at this place, because the wmalloc is actually in a library, and this
exit actually lets no other option to the caller program - there are
some cases when we can simply cancel the current action and continue
instead of crashing.


3. Set the memory to "0". It is interesting for different compilers 
(sometimes set the memory to 0, sometimes no). -> Memory always set to 
0, less errors, no more memory initialization.


That is a point I like about this wmalloc, however this can be a
performance issue when allocating big memory chunks (for example:
loading the background image, when you obviously know that the buffer
will be filled with image's data)


4. You can do "wwin = wmalloc(sizeof(wwin))" instead "wwin = (struct 
wwin*) malloc(wwin)"


Unfortunately this is not true, because both return the same type: 
void*

So, in both case you should:
 - either you use explicit type cast, because you're in C++ which is
strict about it;
 - or you don't, because in plain C that is what void* was made for,
a point-to-anything type.




Is my opinion.


And it looks like from the previous text that my opinion is not, but
that is not true. I think you're quite right about using 
wmalloc/wfree

everywhere:

1. Consistency. Because it is always better to have a code that do
things in many different ways when one was explicitly setup for this;

2. Security, because it is always a bad idea to mix different memory
allocator functions together (try to 'delete' something that was
'wmalloc'ed in C++ and you'll get my point);

3. Ease-of-use, because the day someone will want to make some
analysis on memory usage, he'll be happy that we had used the same
function everywhere;

4. One-place-to-fix-all, because if someday we want to make some
changes to the wait-and-retry or to the exit-on-memfull behaviour,
we'll be happy that it is found in one single place.



Yes, you did a good analysis. If you think that the current 
wmalloc/wfree can be better (for example, your point about memory 
available retry), we can change it.


kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Re : [PATCH 2/3] wcore set vmask in one step

2012-10-09 Thread kix

On 2012-10-09 01:08, Christophe wrote:

Hi Rodolfo,

While having a quick look at this patch, I noticed something that
looks plain wrong to me in the original code:

- Rodolfo García Peñas  a écrit :


From a280e1aa0fe1e2500f6f687b7b195cbb2bca9ba2 Mon Sep 17 00:00:00 
2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= 


Date: Sat, 6 Oct 2012 18:18:43 +0200
Subject: [PATCH 2/3] wcore set vmask in one step

[...]

-	vmask = CWBorderPixel | CWCursor | CWEventMask | 
CWOverrideRedirect;
+	vmask = CWBorderPixel | CWCursor | CWEventMask | 
CWOverrideRedirect | CWColormap;

attribs.override_redirect = True;
attribs.cursor = wCursor[WCUR_DEFAULT];
attribs.background_pixmap = None;


the attribs 'background_pixmap' and 'background_pixel' but the
corresponding flags (CWBackPixmap and CWBackPixel) are not set (but
that's not really a problem).


@@ -99,14 +98,13 @@ WCoreWindow *wCoreCreate(WCoreWindow *parent, 
int x, int y, int width, int heigh


-   vmask = CWBorderPixel | CWCursor | CWEventMask;
+   vmask = CWBorderPixel | CWCursor | CWEventMask | CWColormap;
attribs.cursor = wCursor[WCUR_DEFAULT];
attribs.background_pixmap = None;
attribs.background_pixel = parent->screen_ptr->black_pixel;
 	attribs.event_mask = KeyPressMask | KeyReleaseMask | 
ButtonPressMask |

 ButtonReleaseMask | ButtonMotionMask |
 ExposureMask | EnterWindowMask | LeaveWindowMask;
-   vmask |= CWColormap;
attribs.colormap = parent->screen_ptr->w_colormap;


This time it's a bit worse, because it uses flag 'CWBorderPixel' but
does not set the field 'border_pixel'. It also sets fields
'background_*' with no use as the corresponding flags are missing.

Probably no risk of crash, just a wrong border color on some (old) 
display.


Regards,
Christophe.


Hi Christophe,

thanks for your review. I have a doubt about your comments.

In the original code:

1. Set vmask
2. Set attribs (and attribs flags)
3. vmask changed (|=)

But vmask and attribs (and the flags) are not used yet (only assigned). 
So, we can do (the patch):


1. Set vmask (|= included)
2. Set attribs.

I cannot see the problem :-( I am missing something?

Thanks!
kix

--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Re : [PATCH] New function remove_wwindowstate

2012-10-09 Thread kix

On 2012-10-09 01:09, Carlos R. Mafra wrote:

On Tue,  9 Oct 2012 at  0:58:19 +0200, Christophe wrote:

- Rodolfo García Peñas  a écrit :
>
> From ade4a2246b8c6f76df2c9c5a4799c356b29d0b94 Mon Sep 17 00:00:00 
2001
> From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= 


> Date: Sat, 6 Oct 2012 15:15:51 +0200
> Subject: [PATCH] New function remove_wwindowstate
>
> The common code in the functions wWindowDeleteSavedState and
> wWindowDeleteSavedStatesForPID is moved to a new function 
remove_wwindowstate.

> ---
>  src/window.c |   54 
++

>  1 file changed, 22 insertions(+), 32 deletions(-)
>

Hi,

It's a bit late to say anything about this has it has already been
imported in the Repository, but I'd like to make a small comment:


It's never too late. The branch 'next' is meant to be rebased when
the need arrives.


you name the function "remove_*", which makes think that it would
remove the entry from the list, but the function does not do that, 
it

just frees the memory, so it may have been better called "free_" (or
maybe "release_")?



Good point, release_ makes more sense to me.


Of course, no problem for me. Feel free to send the patch, I am busy 
now :-(


--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Comments about the new menu (cpp patches)

2012-10-09 Thread kix

Hi,

I was using the new patches about menu. All is fine, I think that 
Christophe did a very good job.


I only found a little problem with the menu parsing. When I send the 
"Debian 0.95.3-20120909-1 version" patch, I send the 
debian/debianfiles/conf/WindowMaker with an error (yes, sorry). The file 
is here:


http://repo.or.cz/w/wmaker-crm.git/blob/0e995bbf6ea91d8ff18009ce29219a171d92c808:/debian/debianfiles/conf/WindowMaker

I didn't send a patch to this problem, because I was waiting to add 
more changes in the debian folder (I am working in menu v2 and other 
little changes), and to avoid Carlos uploads this "little" patch. What 
is the problem?

See these lines:

17 "/usr/share/icons",
18   );
19   PixmapPath = (
20 "~/GNUstep/Library/WindowMaker/Pixmaps",
21 "~/GNUstep/Library/WindowMaker/Backgrounds",
22 "/usr/local/share/WindowMaker/Pixmaps",
23 "/usr/local/share/WindowMaker/Backgrounds",
24 "/usr/share/WindowMaker/Backgrounds",
25 "/usr/share/WindowMaker/Pixmaps",
26 "/usr/local/share/pixmaps",
27 "/usr/share/pixmaps",
28   );

Lines 17 and 27 includes an extra comma at the end.

This commas make that windowmaker has an extrange behaviour, for 
example if the menu is outside of the screen is not moved inside,...


I know that the problem is in the configuration file, but I don't know 
if the menu parser can help here. Anyway, the patches about menu are so 
good. Thanks.


Regards,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 01/17] wmspec code clean - messages

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The wmessage function returns "enter" in two functions, so is
not possible to know the function that sends the message.

Is better to replace it with the function name.
---
 src/wmspec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index db3526f..94e55a8 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -532,7 +532,7 @@ void wNETWMInitStuff(WScreen * scr)
int i;
 
 #ifdef DEBUG_WMSPEC
-   wmessage("enter");
+   wmessage("wNETWMInitStuff");
 #endif
 
 #ifdef HAVE_XINTERNATOMS
@@ -1314,7 +1314,7 @@ Bool wNETWMCheckInitialClientState(WWindow * wwin)
Bool hasState = False;
 
 #ifdef DEBUG_WMSPEC
-   wmessage("enter");
+   wmessage("wNETWMCheckInitialClientState");
 #endif
 
wNETWMShowingDesktop(wwin->screen_ptr, False);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 02/17] wNETWMShowingDesktop is now static

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wNETWMShowingDesktop is only used at wmspec.c, so
can be static.
---
 src/wmspec.c |3 ++-
 src/wmspec.h |1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index 94e55a8..f73f150 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -229,6 +229,7 @@ static void updateClientListStacking(WScreen * scr, WWindow 
*);
 static void updateWorkspaceNames(WScreen * scr);
 static void updateCurrentWorkspace(WScreen * scr);
 static void updateWorkspaceCount(WScreen * scr);
+static void wNETWMShowingDesktop(WScreen *scr, Bool show);
 
 typedef struct NetData {
WScreen *scr;
@@ -486,7 +487,7 @@ static void updateShowDesktop(WScreen * scr, Bool show)
PropModeReplace, (unsigned char *)&foo, 1);
 }
 
-void wNETWMShowingDesktop(WScreen * scr, Bool show)
+static void wNETWMShowingDesktop(WScreen *scr, Bool show)
 {
if (show && scr->netdata->show_desktop == NULL) {
WWindow *tmp, **wins;
diff --git a/src/wmspec.h b/src/wmspec.h
index 0337684..e7438dc 100644
--- a/src/wmspec.h
+++ b/src/wmspec.h
@@ -36,7 +36,6 @@ Bool wNETWMCheckInitialClientState(WWindow *wwin);
 Bool wNETWMProcessClientMessage(XClientMessageEvent *event);
 Bool wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace);
 Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
-void wNETWMShowingDesktop(WScreen *scr, Bool show);
 void wNETWMUpdateActions(WWindow *wwin, Bool del);
 void wNETWMUpdateDesktop(WScreen *scr);
 void wNETWMPositionSplash(WWindow *wwin, int *x, int *y, int width, int 
height);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 04/17] Code not needed at wWindowSetupInitialAttributes

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The variable "check" is always False, so the if (!False) is always
True and the function wNETWMCheckClientHints is always called.

The variable check is not used anymore, so the variable check
can be removed.
---
 src/window.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/window.c b/src/window.c
index 3d12c50..f0f093d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -353,16 +353,12 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int 
*level, int *workspace)
} else {
int tmp_workspace = -1;
int tmp_level = INT_MIN;/* INT_MIN is never used by the 
window levels */
-   Bool check;
-
-   check = False;
 
 #ifdef MWM_HINTS
wMWMCheckClientHints(wwin);
 #endif /* MWM_HINTS */
 
-   if (!check)
-   check = wNETWMCheckClientHints(wwin, &tmp_level, 
&tmp_workspace);
+   wNETWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
 
/* window levels are between INT_MIN+1 and INT_MAX, so if we 
still
 * have INT_MIN that means that no window level was requested. 
-Dan
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 03/17] wNETWMCheckInitialClientState is now void

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wNETWMCheckInitialClientState returns a Bool,
but this value is never used, so the function can be void.

kix@osaka:~/src/wmaker/wmaker-crm-tosnd/src$ grep wNETWMCheckInitialClientState 
*.[ch]
window.c:   wNETWMCheckInitialClientState(wwin);
wmspec.c:Bool wNETWMCheckInitialClientState(WWindow * wwin)
wmspec.c:   wmessage("wNETWMCheckInitialClientState");
wmspec.h:Bool wNETWMCheckInitialClientState(WWindow *wwin);
kix@osaka:~/src/wmaker/wmaker-crm-tosnd/src$
---
 src/wmspec.c |9 ++---
 src/wmspec.h |2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index f73f150..d2b335b 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1310,21 +1310,16 @@ static Bool updateNetIconInfo(WWindow * wwin)
return hasState;
 }
 
-Bool wNETWMCheckInitialClientState(WWindow * wwin)
+void wNETWMCheckInitialClientState(WWindow *wwin)
 {
-   Bool hasState = False;
-
 #ifdef DEBUG_WMSPEC
wmessage("wNETWMCheckInitialClientState");
 #endif
 
wNETWMShowingDesktop(wwin->screen_ptr, False);
 
-   hasState |= updateNetIconInfo(wwin);
-
+   updateNetIconInfo(wwin);
updateIconImage(wwin);
-
-   return hasState;
 }
 
 static void handleDesktopNames(XClientMessageEvent * event, WScreen * scr)
diff --git a/src/wmspec.h b/src/wmspec.h
index e7438dc..fd70052 100644
--- a/src/wmspec.h
+++ b/src/wmspec.h
@@ -32,7 +32,7 @@ void wNETWMInitStuff(WScreen *scr);
 void wNETWMCleanup(WScreen *scr);
 void wNETWMUpdateWorkarea(WScreen *scr, WArea usableArea);
 Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area);
-Bool wNETWMCheckInitialClientState(WWindow *wwin);
+void wNETWMCheckInitialClientState(WWindow *wwin);
 Bool wNETWMProcessClientMessage(XClientMessageEvent *event);
 Bool wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace);
 Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 05/17] wNETWMCheckClientHints should be void

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wNETWMCheckClientHints returns a Boolean, but
this value is never used, so can be removed.

This patch removes the boolean returned, the variable hasState,
and so some parts of the function changes.
The patch also moves some variable definition to the same line:
one type, one line.
---
 src/wmspec.c |   24 +++-
 src/wmspec.h |2 +-
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index d2b335b..76e72a9 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1193,15 +1193,12 @@ static void updateWindowType(WWindow * wwin)
}
 }
 
-Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, int *workspace)
+void wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace)
 {
Atom type_ret;
-   int fmt_ret;
-   unsigned long nitems_ret;
-   unsigned long bytes_after_ret;
+   int fmt_ret, i;
+   unsigned long nitems_ret, bytes_after_ret;
long *data = NULL;
-   Bool hasState = False;
-   int i;
 
if (XGetWindowProperty(dpy, wwin->client_win, net_wm_desktop, 0, 1, 
False,
   XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
@@ -1214,8 +1211,6 @@ Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, 
int *workspace)
wwin->client_flags.omnipresent = 1;
else
*workspace = desktop;
-
-   hasState = True;
}
 
if (XGetWindowProperty(dpy, wwin->client_win, net_wm_state, 0, 1, False,
@@ -1223,11 +1218,10 @@ Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, 
int *workspace)
   &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
Atom *state = (Atom *) data;
-   for (i = 0; i < nitems_ret; ++i) {
+   for (i = 0; i < nitems_ret; ++i)
doStateAtom(wwin, state[i], _NET_WM_STATE_ADD, True);
-   }
+
XFree(data);
-   hasState = True;
}
 
if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0, 1, 
False,
@@ -1240,17 +1234,13 @@ Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, 
int *workspace)
break;
}
XFree(data);
-   hasState = True;
}
 
wNETWMUpdateActions(wwin, False);
updateStrut(wwin, False);
-   if (updateStrut(wwin, True)) {
-   hasState = True;
-   }
-   wScreenUpdateUsableArea(wwin->screen_ptr);
+   updateStrut(wwin, True);
 
-   return hasState;
+   wScreenUpdateUsableArea(wwin->screen_ptr);
 }
 
 static Bool updateNetIconInfo(WWindow * wwin)
diff --git a/src/wmspec.h b/src/wmspec.h
index fd70052..af75684 100644
--- a/src/wmspec.h
+++ b/src/wmspec.h
@@ -34,7 +34,7 @@ void wNETWMUpdateWorkarea(WScreen *scr, WArea usableArea);
 Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area);
 void wNETWMCheckInitialClientState(WWindow *wwin);
 Bool wNETWMProcessClientMessage(XClientMessageEvent *event);
-Bool wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace);
+void wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace);
 Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
 void wNETWMUpdateActions(WWindow *wwin, Bool del);
 void wNETWMUpdateDesktop(WScreen *scr);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 06/17] wNETWMCheckClientHintChange should be void

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wNETWMCheckClientHintChange returns a Bool,
but this value is never used, son can be removed.

This function now is void.

kix@osaka:~/src/wmaker/wmaker-crm-tosnd/src$ grep wNETWMCheckClientHintChange 
*.[ch]
client.c:   wNETWMCheckClientHintChange(wwin, event);
wmspec.c:Bool wNETWMCheckClientHintChange(WWindow * wwin, XPropertyEvent * 
event)
wmspec.h:Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
---
 src/wmspec.c |8 +---
 src/wmspec.h |2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index 76e72a9..9424012 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1457,10 +1457,8 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent * 
event)
return done;
 }
 
-Bool wNETWMCheckClientHintChange(WWindow * wwin, XPropertyEvent * event)
+void wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event)
 {
-   Bool ret = True;
-
 #ifdef DEBUG_WMSPEC
wmessage("clientHintChange type %s\n", XGetAtomName(dpy, event->atom));
 #endif
@@ -1485,11 +1483,7 @@ Bool wNETWMCheckClientHintChange(WWindow * wwin, 
XPropertyEvent * event)
}
} else if (event->atom == net_wm_icon) {
updateIconImage(wwin);
-   } else {
-   ret = False;
}
-
-   return ret;
 }
 
 int wNETWMGetPidForWindow(Window window)
diff --git a/src/wmspec.h b/src/wmspec.h
index af75684..63d1eff 100644
--- a/src/wmspec.h
+++ b/src/wmspec.h
@@ -35,7 +35,7 @@ Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area);
 void wNETWMCheckInitialClientState(WWindow *wwin);
 Bool wNETWMProcessClientMessage(XClientMessageEvent *event);
 void wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace);
-Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
+void wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
 void wNETWMUpdateActions(WWindow *wwin, Bool del);
 void wNETWMUpdateDesktop(WScreen *scr);
 void wNETWMPositionSplash(WWindow *wwin, int *x, int *y, int width, int 
height);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 08/17] get_pixmap_icon_from_user_icon extra argument removed

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_user_icon uses the argument
scr (WScreen) that is not needed, because the argument is in the
struct WIcon, the other function argument.

This patch removes the argument WScreen and provides it in the function
using WIcon.
---
 src/icon.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 0370d71..f06f526 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -62,7 +62,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 
 void get_pixmap_icon_from_icon_win(WIcon *icon);
 int get_pixmap_icon_from_wm_hints(WScreen *scr, WWindow *wwin, WIcon *icon);
-void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon);
+void get_pixmap_icon_from_user_icon(WIcon *icon);
 /** Notification Observers **/
 
 static void appearanceObserver(void *self, WMNotification * notif)
@@ -570,7 +570,7 @@ void wIconSelect(WIcon * icon)
}
 }
 
-void wIconUpdate(WIcon * icon)
+void wIconUpdate(WIcon *icon)
 {
WScreen *scr = icon->core->screen_ptr;
WWindow *wwin = icon->owner;
@@ -584,7 +584,7 @@ void wIconUpdate(WIcon * icon)
 
if (wwin && WFLAGP(wwin, always_user_icon)) {
/* Forced use user_icon */
-   get_pixmap_icon_from_user_icon(scr, icon);
+   get_pixmap_icon_from_user_icon(icon);
} else if (icon->icon_win != None) {
/* Get the Pixmap from the WIcon */
get_pixmap_icon_from_icon_win(icon);
@@ -595,10 +595,10 @@ void wIconUpdate(WIcon * icon)
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & 
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
if (get_pixmap_icon_from_wm_hints(scr, wwin, icon))
-   get_pixmap_icon_from_user_icon(scr, icon);
+   get_pixmap_icon_from_user_icon(icon);
} else {
/* Get the Pixmap from the user */
-   get_pixmap_icon_from_user_icon(scr, icon);
+   get_pixmap_icon_from_user_icon(icon);
}
 
/* No pixmap, set default background */
@@ -610,11 +610,11 @@ void wIconUpdate(WIcon * icon)
wIconPaint(icon);
 }
 
-void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon)
+void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
RImage *image = NULL;
-   char *path;
-   char *file;
+   char *path, *file;
+   WScreen *scr = icon->core->screen_ptr;
 
if (icon->file_image) {
icon->pixmap = makeIcon(scr, icon->file_image, icon->show_title,
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 07/17] wmspec code clean - style

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch do these changes:

1. Removes the extra curly brackets
2. Add curly brackets if needed (code style)
3. Removes spaces in the function prototypes/declaration
   I think this is the best moment to do it, all together
   in a style clean patch.
4. Moves variable definition with the same type to the same line
---
 src/wmspec.c |  199 +++---
 1 file changed, 93 insertions(+), 106 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index 9424012..1e70089 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -220,15 +220,15 @@ static atomitem_t atomNames[] = {
 #define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
 #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD10 /* move via keyboard */
 
-static void observer(void *self, WMNotification * notif);
-static void wsobserver(void *self, WMNotification * notif);
+static void observer(void *self, WMNotification *notif);
+static void wsobserver(void *self, WMNotification *notif);
 
-static void updateClientList(WScreen * scr);
-static void updateClientListStacking(WScreen * scr, WWindow *);
+static void updateClientList(WScreen *scr);
+static void updateClientListStacking(WScreen *scr, WWindow *);
 
-static void updateWorkspaceNames(WScreen * scr);
-static void updateCurrentWorkspace(WScreen * scr);
-static void updateWorkspaceCount(WScreen * scr);
+static void updateWorkspaceNames(WScreen *scr);
+static void updateCurrentWorkspace(WScreen *scr);
+static void updateWorkspaceCount(WScreen *scr);
 static void wNETWMShowingDesktop(WScreen *scr, Bool show);
 
 typedef struct NetData {
@@ -237,7 +237,7 @@ typedef struct NetData {
WWindow **show_desktop;
 } NetData;
 
-static void setSupportedHints(WScreen * scr)
+static void setSupportedHints(WScreen *scr)
 {
Atom atom[atomNr];
int i = 0;
@@ -314,7 +314,7 @@ static void setSupportedHints(WScreen * scr)
32, PropModeReplace, (unsigned char 
*)&scr->info_window, 1);
 }
 
-void wNETWMUpdateDesktop(WScreen * scr)
+void wNETWMUpdateDesktop(WScreen *scr)
 {
long *views, sizes[2];
int count, i;
@@ -342,7 +342,7 @@ void wNETWMUpdateDesktop(WScreen * scr)
wfree(views);
 }
 
-int wNETWMGetCurrentDesktopFromHint(WScreen * scr)
+int wNETWMGetCurrentDesktopFromHint(WScreen *scr)
 {
int count;
unsigned char *prop;
@@ -478,7 +478,7 @@ static void updateIconImage(WWindow *wwin)
}
 }
 
-static void updateShowDesktop(WScreen * scr, Bool show)
+static void updateShowDesktop(WScreen *scr, Bool show)
 {
long foo;
 
@@ -527,7 +527,7 @@ static void wNETWMShowingDesktop(WScreen *scr, Bool show)
}
 }
 
-void wNETWMInitStuff(WScreen * scr)
+void wNETWMInitStuff(WScreen *scr)
 {
NetData *data;
int i;
@@ -541,18 +541,17 @@ void wNETWMInitStuff(WScreen * scr)
Atom atoms[atomNr];
char *names[atomNr];
 
-   for (i = 0; i < atomNr; ++i) {
+   for (i = 0; i < atomNr; ++i)
names[i] = atomNames[i].name;
-   }
+
XInternAtoms(dpy, &names[0], atomNr, False, atoms);
-   for (i = 0; i < atomNr; ++i) {
+   for (i = 0; i < atomNr; ++i)
*atomNames[i].atom = atoms[i];
-   }
+
}
 #else
-   for (i = 0; i < atomNr; i++) {
+   for (i = 0; i < atomNr; i++)
*atomNames[i].atom = XInternAtom(dpy, atomNames[i].name, False);
-   }
 #endif
 
data = wmalloc(sizeof(NetData));
@@ -586,7 +585,7 @@ void wNETWMInitStuff(WScreen * scr)
wScreenUpdateUsableArea(scr);
 }
 
-void wNETWMCleanup(WScreen * scr)
+void wNETWMCleanup(WScreen *scr)
 {
int i;
 
@@ -594,7 +593,7 @@ void wNETWMCleanup(WScreen * scr)
XDeleteProperty(dpy, scr->root_win, *atomNames[i].atom);
 }
 
-void wNETWMUpdateActions(WWindow * wwin, Bool del)
+void wNETWMUpdateActions(WWindow *wwin, Bool del)
 {
Atom action[10];/* nr of actions atoms defined */
int i = 0;
@@ -640,7 +639,7 @@ void wNETWMUpdateActions(WWindow * wwin, Bool del)
XA_ATOM, 32, PropModeReplace, (unsigned char *)action, 
i);
 }
 
-Bool wNETWMGetUsableArea(WScreen * scr, int head, WArea * area)
+Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area)
 {
WReservedArea *cur;
WMRect rect;
@@ -677,7 +676,7 @@ Bool wNETWMGetUsableArea(WScreen * scr, int head, WArea * 
area)
return True;
 }
 
-static void updateClientList(WScreen * scr)
+static void updateClientList(WScreen *scr)
 {
WWindow *wwin;
Window *windows;
@@ -698,15 +697,13 @@ static void updateClientList(WScreen * scr)
XFlush(dpy);
 }
 
-static void updateClientListStacking(WScreen * scr, WWindow * wwin_excl)
+static void updateClientListStacking(WScreen *scr, WWindow *wwin_excl

[PATCH 09/17] get_pixmap_icon_from_wm_hints removed extra arguments

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_wm_hints has two extra arguments
(WScreen and WWindow) not needed, because these arguments can be
accessed using the argument WIcon.

This function removes them in the function definition and provides
them in the function code.
---
 src/icon.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index f06f526..24aff25 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -61,7 +61,7 @@ static void miniwindowDblClick(WObjDescriptor * desc, XEvent 
* event);
 static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y);
 
 void get_pixmap_icon_from_icon_win(WIcon *icon);
-int get_pixmap_icon_from_wm_hints(WScreen *scr, WWindow *wwin, WIcon *icon);
+int get_pixmap_icon_from_wm_hints(WIcon *icon);
 void get_pixmap_icon_from_user_icon(WIcon *icon);
 /** Notification Observers **/
 
@@ -594,7 +594,7 @@ void wIconUpdate(WIcon *icon)
icon->shadowed, 
icon->tile_type, icon->highlighted);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & 
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
-   if (get_pixmap_icon_from_wm_hints(scr, wwin, icon))
+   if (get_pixmap_icon_from_wm_hints(icon))
get_pixmap_icon_from_user_icon(icon);
} else {
/* Get the Pixmap from the user */
@@ -711,12 +711,14 @@ void get_pixmap_icon_from_icon_win(WIcon * icon)
 }
 
 /* Get the Pixmap from the XWindow wm_hints */
-int get_pixmap_icon_from_wm_hints(WScreen *scr, WWindow *wwin, WIcon *icon)
+int get_pixmap_icon_from_wm_hints(WIcon *icon)
 {
Window jw;
Pixmap pixmap;
unsigned int w, h, ju, d;
int ji, x, y;
+   WWindow *wwin = icon->owner;
+   WScreen *scr = icon->core->screen_ptr;
int title_height = WMFontHeight(scr->icon_title_font);
 
if (!XGetGeometry(dpy, wwin->wm_hints->icon_pixmap, &jw, &ji, &ji, &w, 
&h, &ju, &d)) {
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 10/17] New icon_update_pixmap helper function

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function icon_update_pixmap updates the WIcon's pixmap,
using the values in the WIcon struct.

This function provices a clear function to update the icon,
using only the icon, and the new image to set. This option is
better than using "makeIcon" function, with a lot of arguments.

This patch also changes the variable name "icon" to "image",
because is type rimage and then both functions uses the same name.
---
 src/icon.c |   39 ++-
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 24aff25..51f838f 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,6 +63,11 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, 
int coord_y);
 void get_pixmap_icon_from_icon_win(WIcon *icon);
 int get_pixmap_icon_from_wm_hints(WIcon *icon);
 void get_pixmap_icon_from_user_icon(WIcon *icon);
+
+static Pixmap makeIcon(WScreen *scr, RImage *image,
+  int titled, int shadowed,
+  int tileType, int highlighted);
+static void icon_update_pixmap(WIcon *icon, RImage *image);
 /** Notification Observers **/
 
 static void appearanceObserver(void *self, WMNotification * notif)
@@ -265,7 +270,17 @@ static void drawIconTitle(WScreen * scr, Pixmap pixmap, 
int height)
  wPreferences.icon_size - 1, 0, wPreferences.icon_size - 1, 
height + 1);
 }
 
-static Pixmap makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, 
int tileType, int highlighted)
+static void icon_update_pixmap(WIcon *icon, RImage *image)
+{
+   WScreen *scr = icon->core->screen_ptr;
+
+   /* Update the WIcon pixmap */
+   icon->pixmap = makeIcon(scr, image,
+   icon->show_title, icon->shadowed,
+   icon->tile_type, icon->highlighted);
+}
+
+static Pixmap makeIcon(WScreen *scr, RImage *image, int titled, int shadowed, 
int tileType, int highlighted)
 {
RImage *tile;
Pixmap pixmap;
@@ -280,21 +295,21 @@ static Pixmap makeIcon(WScreen *scr, RImage *icon, int 
titled, int shadowed, int
tile = RCloneImage(scr->clip_tile);
}
 
-   if (icon) {
-   w = (icon->width > wPreferences.icon_size)
-   ? wPreferences.icon_size : icon->width;
+   if (image) {
+   w = (image->width > wPreferences.icon_size)
+   ? wPreferences.icon_size : image->width;
x = (wPreferences.icon_size - w) / 2;
-   sx = (icon->width - w) / 2;
+   sx = (image->width - w) / 2;
 
if (titled)
theight = WMFontHeight(scr->icon_title_font);
 
-   h = (icon->height + theight > wPreferences.icon_size
-? wPreferences.icon_size - theight : icon->height);
+   h = (image->height + theight > wPreferences.icon_size
+? wPreferences.icon_size - theight : image->height);
y = theight + (wPreferences.icon_size - theight - h) / 2;
-   sy = (icon->height - h) / 2;
+   sy = (image->height - h) / 2;
 
-   RCombineArea(tile, icon, sx, sy, w, h, x, y);
+   RCombineArea(tile, image, sx, sy, w, h, x, y);
}
 
if (shadowed) {
@@ -590,8 +605,7 @@ void wIconUpdate(WIcon *icon)
get_pixmap_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
/* Use _NET_WM_ICON icon */
-   icon->pixmap = makeIcon(scr, wwin->net_icon_image, 
icon->show_title,
-   icon->shadowed, 
icon->tile_type, icon->highlighted);
+   icon_update_pixmap(icon, wwin->net_icon_image);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & 
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
if (get_pixmap_icon_from_wm_hints(icon))
@@ -617,8 +631,7 @@ void get_pixmap_icon_from_user_icon(WIcon *icon)
WScreen *scr = icon->core->screen_ptr;
 
if (icon->file_image) {
-   icon->pixmap = makeIcon(scr, icon->file_image, icon->show_title,
-   icon->shadowed, icon->tile_type, 
icon->highlighted);
+   icon_update_pixmap(icon, icon->file_image);
} else {
/* make default icons */
if (!scr->def_icon_pixmap) {
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 11/17] declare get_pixmap_icon_from_* as static functions

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The functions:

void get_pixmap_icon_from_icon_win(WIcon *icon);
int get_pixmap_icon_from_wm_hints(WIcon *icon);
void get_pixmap_icon_from_user_icon(WIcon *icon);

should be static, because are only used in icon.c
---
 src/icon.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 51f838f..bb73c64 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -60,9 +60,9 @@ static void miniwindowDblClick(WObjDescriptor * desc, XEvent 
* event);
 
 static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y);
 
-void get_pixmap_icon_from_icon_win(WIcon *icon);
-int get_pixmap_icon_from_wm_hints(WIcon *icon);
-void get_pixmap_icon_from_user_icon(WIcon *icon);
+static void get_pixmap_icon_from_icon_win(WIcon *icon);
+static int get_pixmap_icon_from_wm_hints(WIcon *icon);
+static void get_pixmap_icon_from_user_icon(WIcon *icon);
 
 static Pixmap makeIcon(WScreen *scr, RImage *image,
   int titled, int shadowed,
@@ -624,7 +624,7 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
 }
 
-void get_pixmap_icon_from_user_icon(WIcon *icon)
+static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
RImage *image = NULL;
char *path, *file;
@@ -667,7 +667,7 @@ void get_pixmap_icon_from_user_icon(WIcon *icon)
 }
 
 /* Get the Pixmap from the WIcon of the WWindow */
-void get_pixmap_icon_from_icon_win(WIcon * icon)
+static void get_pixmap_icon_from_icon_win(WIcon * icon)
 {
XWindowAttributes attr;
WScreen *scr = icon->core->screen_ptr;
@@ -724,7 +724,7 @@ void get_pixmap_icon_from_icon_win(WIcon * icon)
 }
 
 /* Get the Pixmap from the XWindow wm_hints */
-int get_pixmap_icon_from_wm_hints(WIcon *icon)
+static int get_pixmap_icon_from_wm_hints(WIcon *icon)
 {
Window jw;
Pixmap pixmap;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 12/17] New helper function get_default_image

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The new function get_default_image creates a RImage with the default
icon. Now the function get_pixmap_icon_from_user_icon() is more clear
and show that, first try to get the user selected image, if not set,
then it gets the default icon.
---
 src/icon.c |   47 ++-
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index bb73c64..2739ca1 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -68,6 +68,8 @@ static Pixmap makeIcon(WScreen *scr, RImage *image,
   int titled, int shadowed,
   int tileType, int highlighted);
 static void icon_update_pixmap(WIcon *icon, RImage *image);
+
+static RImage *get_default_image(WScreen *scr);
 /** Notification Observers **/
 
 static void appearanceObserver(void *self, WMNotification * notif)
@@ -627,7 +629,6 @@ void wIconUpdate(WIcon *icon)
 static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
RImage *image = NULL;
-   char *path, *file;
WScreen *scr = icon->core->screen_ptr;
 
if (icon->file_image) {
@@ -635,22 +636,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon)
} else {
/* make default icons */
if (!scr->def_icon_pixmap) {
-   /* Get the default icon */
-   file = wDefaultGetIconFile(NULL, NULL, True);
-   if (file) {
-   path = FindImage(wPreferences.icon_path, file);
-   if (path) {
-   image = RLoadImage(scr->rcontext, path, 
0);
-   if (!image)
-   wwarning(_("could not load 
default icon \"%s\":%s"),
-file, 
RMessageForError(RErrorCode));
-   wfree(path);
-   } else {
-   wwarning(_("could not find default icon 
\"%s\""), file);
-   }
-   }
-
-   image = wIconValidateIconSize(image, 
wPreferences.icon_size);
+   image = get_default_image(scr);
scr->def_icon_pixmap = makeIcon(scr, image, False, 
False, icon->tile_type, icon->highlighted);
scr->def_ticon_pixmap = makeIcon(scr, image, True, 
False, icon->tile_type, icon->highlighted);
if (image)
@@ -666,6 +652,33 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon)
}
 }
 
+/* This function creates the RImage using the default icon */
+static RImage *get_default_image(WScreen *scr)
+{
+   RImage *image = NULL;
+   char *path, *file;
+
+   /* Get the default icon */
+   file = wDefaultGetIconFile(NULL, NULL, True);
+   if (file) {
+   path = FindImage(wPreferences.icon_path, file);
+   if (path) {
+   image = RLoadImage(scr->rcontext, path, 0);
+   if (!image)
+   wwarning(_("could not load default icon 
\"%s\":%s"),
+file, RMessageForError(RErrorCode));
+   wfree(path);
+   } else {
+   wwarning(_("could not find default icon \"%s\""), file);
+   }
+   }
+
+   /* Validate the icon size */
+   image = wIconValidateIconSize(image, wPreferences.icon_size);
+
+   return image;
+}
+
 /* Get the Pixmap from the WIcon of the WWindow */
 static void get_pixmap_icon_from_icon_win(WIcon * icon)
 {
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 13/17] Better default icon management

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch replaces the Pixmap icons from screen.h with only one
RImage. This image is not processed yet, therefore could be used
for icons with title or without it (replacing def_ticon_pixmap and
def_icon_pixmap variables).

Now the code is better because the Pixmap is generated and saved in
the icon structure.

See that before this patch, the icon->pixmap was set to None!!
With this patch, the icon->pixmap is saved, using the common
method used in the other functions to create Pixmaps, the function
icon_update_pixmap().
---
 src/defaults.c |   14 +-
 src/icon.c |   24 
 src/screen.h   |7 +++
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/src/defaults.c b/src/defaults.c
index 4bf9aff..458093c 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -2381,18 +2381,14 @@ static int setIconTile(WScreen * scr, WDefaultEntry * 
entry, WTexture ** texture
 
scr->icon_tile_pixmap = pixmap;
 
-   if (scr->def_icon_pixmap) {
-   XFreePixmap(dpy, scr->def_icon_pixmap);
-   scr->def_icon_pixmap = None;
-   }
-   if (scr->def_ticon_pixmap) {
-   XFreePixmap(dpy, scr->def_ticon_pixmap);
-   scr->def_ticon_pixmap = None;
+   if (scr->def_icon_rimage) {
+   RReleaseImage(scr->def_icon_rimage);
+   scr->def_icon_rimage = NULL;
}
 
-   if (scr->icon_back_texture) {
+   if (scr->icon_back_texture)
wTextureDestroy(scr, (WTexture *) scr->icon_back_texture);
-   }
+
scr->icon_back_texture = wTextureMakeSolid(scr, 
&((*texture)->any.color));
 
if (scr->clip_balloon)
diff --git a/src/icon.c b/src/icon.c
index 2739ca1..b0da0d8 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -628,28 +628,20 @@ void wIconUpdate(WIcon *icon)
 
 static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
-   RImage *image = NULL;
WScreen *scr = icon->core->screen_ptr;
 
+   /* If the icon has image, update it and continue */
if (icon->file_image) {
icon_update_pixmap(icon, icon->file_image);
-   } else {
-   /* make default icons */
-   if (!scr->def_icon_pixmap) {
-   image = get_default_image(scr);
-   scr->def_icon_pixmap = makeIcon(scr, image, False, 
False, icon->tile_type, icon->highlighted);
-   scr->def_ticon_pixmap = makeIcon(scr, image, True, 
False, icon->tile_type, icon->highlighted);
-   if (image)
-   RReleaseImage(image);
-   }
+   return;
+   }
 
-   if (icon->show_title)
-   XSetWindowBackgroundPixmap(dpy, icon->core->window, 
scr->def_ticon_pixmap);
-   else
-   XSetWindowBackgroundPixmap(dpy, icon->core->window, 
scr->def_icon_pixmap);
+   /* If the icon don't have image, we should use the default image. */
+   if (!scr->def_icon_rimage)
+   scr->def_icon_rimage = get_default_image(scr);
 
-   icon->pixmap = None;
-   }
+   /* Now, create the pixmap using the default (saved) image */
+   icon_update_pixmap(icon, scr->def_icon_rimage);
 }
 
 /* This function creates the RImage using the default icon */
diff --git a/src/screen.h b/src/screen.h
index f021096..dfdbd63 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -229,13 +229,12 @@ typedef struct _WScreen {
 
 struct RImage *icon_tile;
 struct RImage *clip_tile;
-Pixmap icon_tile_pixmap;  /* for app supplied icons */
 
-Pixmap def_icon_pixmap;   /* default icons */
-Pixmap def_ticon_pixmap;
+Pixmap icon_tile_pixmap;   /* For app supplied icons */
 
-struct WDialogData *dialog_data;
+struct RImage *def_icon_rimage;/* Default RImage icon */
 
+struct WDialogData *dialog_data;
 
 struct W_GeometryView *gview;  /* size/position view */
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 14/17] Function makeIcon removed

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function makeIcon is only used in icon_update_pixmap(), so
both functions can be joined. Now the function icon_update_pixmap()
includes the contents of makeIcon.
---
 src/icon.c |   23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index b0da0d8..791f8fb 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -64,9 +64,6 @@ static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
 
-static Pixmap makeIcon(WScreen *scr, RImage *image,
-  int titled, int shadowed,
-  int tileType, int highlighted);
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 
 static RImage *get_default_image(WScreen *scr);
@@ -274,23 +271,15 @@ static void drawIconTitle(WScreen * scr, Pixmap pixmap, 
int height)
 
 static void icon_update_pixmap(WIcon *icon, RImage *image)
 {
-   WScreen *scr = icon->core->screen_ptr;
-
-   /* Update the WIcon pixmap */
-   icon->pixmap = makeIcon(scr, image,
-   icon->show_title, icon->shadowed,
-   icon->tile_type, icon->highlighted);
-}
-
-static Pixmap makeIcon(WScreen *scr, RImage *image, int titled, int shadowed, 
int tileType, int highlighted)
-{
RImage *tile;
Pixmap pixmap;
int x, y, sx, sy;
unsigned w, h;
int theight = 0;
+   WScreen *scr = icon->core->screen_ptr;
+   int titled = icon->show_title;
 
-   if (tileType == TILE_NORMAL) {
+   if (icon->tile_type == TILE_NORMAL) {
tile = RCloneImage(scr->icon_tile);
} else {
assert(scr->clip_tile);
@@ -314,7 +303,7 @@ static Pixmap makeIcon(WScreen *scr, RImage *image, int 
titled, int shadowed, in
RCombineArea(tile, image, sx, sy, w, h, x, y);
}
 
-   if (shadowed) {
+   if (icon->shadowed) {
RColor color;
 
color.red = scr->icon_back_texture->light.red >> 8;
@@ -324,7 +313,7 @@ static Pixmap makeIcon(WScreen *scr, RImage *image, int 
titled, int shadowed, in
RClearImage(tile, &color);
}
 
-   if (highlighted) {
+   if (icon->highlighted) {
RColor color;
 
color.red = color.green = color.blue = 0;
@@ -340,7 +329,7 @@ static Pixmap makeIcon(WScreen *scr, RImage *image, int 
titled, int shadowed, in
if (titled)
drawIconTitle(scr, pixmap, theight);
 
-   return pixmap;
+   icon->pixmap = pixmap;
 }
 
 void wIconChangeTitle(WIcon * icon, char *new_title)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 15/17] New helper function get_pixmap_icon_from_default_icon

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The new helper function get_pixmap_icon_from_default_icon search
the default icon in the disk and return it.

Now get_pixmap_icon_from_user_icon() returns do the work about
search the user icon, and the work about default icon is splitted
in the function get_pixmap_icon_from_user_icon.
---
 src/icon.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 791f8fb..95ab568 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,6 +63,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
+static void get_pixmap_icon_from_default_icon(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 
@@ -617,14 +618,19 @@ void wIconUpdate(WIcon *icon)
 
 static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
-   WScreen *scr = icon->core->screen_ptr;
-
/* If the icon has image, update it and continue */
if (icon->file_image) {
icon_update_pixmap(icon, icon->file_image);
return;
}
 
+   get_pixmap_icon_from_default_icon(icon);
+}
+
+static void get_pixmap_icon_from_default_icon(WIcon *icon)
+{
+   WScreen *scr = icon->core->screen_ptr;
+
/* If the icon don't have image, we should use the default image. */
if (!scr->def_icon_rimage)
scr->def_icon_rimage = get_default_image(scr);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 16/17] Changed get_default_icon_rimage function name

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_default_icon_rimage name is not correct, because
the function doesn't return the default icon rimage, returns the
rimage from a file name. So the correct function name should be
get_rimage_from_file.
---
 src/defaults.h  |2 +-
 src/icon.c  |4 ++--
 src/wdefaults.c |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/defaults.h b/src/defaults.h
index 87ea8fb..2541f20 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -50,5 +50,5 @@ int wDefaultGetStartWorkspace(WScreen *scr, char *instance, 
char *class);
 void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
 char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, 
char *command,
Bool default_icon);
-RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size);
+RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
 #endif /* WMDEFAULTS_H_ */
diff --git a/src/icon.c b/src/icon.c
index 95ab568..b4ccfc5 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -142,7 +142,7 @@ WIcon *icon_create_for_wwindow(WWindow *wwin)
file = get_default_icon_filename(scr, wwin->wm_instance, 
wwin->wm_class, NULL, True);
if (file) {
icon->file = wstrdup(file);
-   icon->file_image = get_default_icon_rimage(scr, icon->file, 
wPreferences.icon_size);
+   icon->file_image = get_rimage_from_file(scr, icon->file, 
wPreferences.icon_size);
wfree(file);
}
 
@@ -167,7 +167,7 @@ WIcon *icon_create_for_dock(WScreen *scr, char *command, 
char *wm_instance, char
file = get_default_icon_filename(scr, wm_instance, wm_class, command, 
False);
if (file) {
icon->file = wstrdup(file);
-   icon->file_image = get_default_icon_rimage(scr, icon->file, 
wPreferences.icon_size);
+   icon->file_image = get_rimage_from_file(scr, icon->file, 
wPreferences.icon_size);
wfree(file);
}
 
diff --git a/src/wdefaults.c b/src/wdefaults.c
index c4cd819..8a4cdab 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -420,7 +420,7 @@ char *get_default_icon_filename(WScreen *scr, char 
*winstance, char *wclass, cha
 }
 
 /* This function returns the image picture for the file_name file */
-RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size)
+RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size)
 {
RImage *image = NULL;
 
@@ -446,7 +446,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, 
char *wclass, int max_s
if (!file_name)
return NULL;
 
-   return get_default_icon_rimage(scr, file_name, max_size);
+   return get_rimage_from_file(scr, file_name, max_size);
 }
 
 int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 17/17] remove_wwindowstate name changed

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function remove_wwindowstate is now remove_wwindowstate. This was
proposed by Christophe and Carlos:

- - -
On 2012-10-09 01:09, Carlos R. Mafra wrote:
> On Tue,  9 Oct 2012 at  0:58:19 +0200, Christophe wrote:
> you name the function "remove_*", which makes think that it would
> remove the entry from the list, but the function does not do that, it
> just frees the memory, so it may have been better called "free_" (or
> maybe "release_")?
>

Good point, release_ makes more sense to me.
- - -
---
 src/window.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/window.c b/src/window.c
index f0f093d..4691021 100644
--- a/src/window.c
+++ b/src/window.c
@@ -109,7 +109,7 @@ static void titlebarMouseDown(WCoreWindow *sender, void 
*data, XEvent *event);
 static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event);
 static void resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event);
 
-static void remove_wwindowstate(WWindowState *wstate);
+static void release_wwindowstate(WWindowState *wstate);
 
 /** Notification Observers **/
 
@@ -2598,12 +2598,12 @@ void wWindowDeleteSavedState(WMagicNumber id)
tmp = windowState;
if (tmp == wstate) {
windowState = wstate->next;
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
} else {
while (tmp->next) {
if (tmp->next == wstate) {
tmp->next = wstate->next;
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
break;
}
tmp = tmp->next;
@@ -2623,13 +2623,13 @@ void wWindowDeleteSavedStatesForPID(pid_t pid)
wstate = windowState;
windowState = tmp->next;
 
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
} else {
while (tmp->next) {
if (tmp->next->pid == pid) {
wstate = tmp->next;
tmp->next = wstate->next;
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
break;
}
tmp = tmp->next;
@@ -2637,7 +2637,7 @@ void wWindowDeleteSavedStatesForPID(pid_t pid)
}
 }
 
-static void remove_wwindowstate(WWindowState *wstate)
+static void release_wwindowstate(WWindowState *wstate)
 {
if (wstate->instance)
wfree(wstate->instance);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 15/17] New helper function get_pixmap_icon_from_default_icon

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The new helper function get_pixmap_icon_from_default_icon search
the default icon in the disk and return it.

Now get_pixmap_icon_from_user_icon() returns do the work about
search the user icon, and the work about default icon is splitted
in the function get_pixmap_icon_from_user_icon.
---
 src/icon.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 791f8fb..95ab568 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,6 +63,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
+static void get_pixmap_icon_from_default_icon(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 
@@ -617,14 +618,19 @@ void wIconUpdate(WIcon *icon)
 
 static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
-   WScreen *scr = icon->core->screen_ptr;
-
/* If the icon has image, update it and continue */
if (icon->file_image) {
icon_update_pixmap(icon, icon->file_image);
return;
}
 
+   get_pixmap_icon_from_default_icon(icon);
+}
+
+static void get_pixmap_icon_from_default_icon(WIcon *icon)
+{
+   WScreen *scr = icon->core->screen_ptr;
+
/* If the icon don't have image, we should use the default image. */
if (!scr->def_icon_rimage)
scr->def_icon_rimage = get_default_image(scr);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 17/17] remove_wwindowstate name changed

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function remove_wwindowstate is now remove_wwindowstate. This was
proposed by Christophe and Carlos:

- - -
On 2012-10-09 01:09, Carlos R. Mafra wrote:
> On Tue,  9 Oct 2012 at  0:58:19 +0200, Christophe wrote:
> you name the function "remove_*", which makes think that it would
> remove the entry from the list, but the function does not do that, it
> just frees the memory, so it may have been better called "free_" (or
> maybe "release_")?
>

Good point, release_ makes more sense to me.
- - -
---
 src/window.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/window.c b/src/window.c
index f0f093d..4691021 100644
--- a/src/window.c
+++ b/src/window.c
@@ -109,7 +109,7 @@ static void titlebarMouseDown(WCoreWindow *sender, void 
*data, XEvent *event);
 static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event);
 static void resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event);
 
-static void remove_wwindowstate(WWindowState *wstate);
+static void release_wwindowstate(WWindowState *wstate);
 
 /** Notification Observers **/
 
@@ -2598,12 +2598,12 @@ void wWindowDeleteSavedState(WMagicNumber id)
tmp = windowState;
if (tmp == wstate) {
windowState = wstate->next;
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
} else {
while (tmp->next) {
if (tmp->next == wstate) {
tmp->next = wstate->next;
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
break;
}
tmp = tmp->next;
@@ -2623,13 +2623,13 @@ void wWindowDeleteSavedStatesForPID(pid_t pid)
wstate = windowState;
windowState = tmp->next;
 
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
} else {
while (tmp->next) {
if (tmp->next->pid == pid) {
wstate = tmp->next;
tmp->next = wstate->next;
-   remove_wwindowstate(wstate);
+   release_wwindowstate(wstate);
break;
}
tmp = tmp->next;
@@ -2637,7 +2637,7 @@ void wWindowDeleteSavedStatesForPID(pid_t pid)
}
 }
 
-static void remove_wwindowstate(WWindowState *wstate)
+static void release_wwindowstate(WWindowState *wstate)
 {
if (wstate->instance)
wfree(wstate->instance);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 13/17] Better default icon management

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch replaces the Pixmap icons from screen.h with only one
RImage. This image is not processed yet, therefore could be used
for icons with title or without it (replacing def_ticon_pixmap and
def_icon_pixmap variables).

Now the code is better because the Pixmap is generated and saved in
the icon structure.

See that before this patch, the icon->pixmap was set to None!!
With this patch, the icon->pixmap is saved, using the common
method used in the other functions to create Pixmaps, the function
icon_update_pixmap().
---
 src/defaults.c |   14 +-
 src/icon.c |   24 
 src/screen.h   |7 +++
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/src/defaults.c b/src/defaults.c
index 4bf9aff..458093c 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -2381,18 +2381,14 @@ static int setIconTile(WScreen * scr, WDefaultEntry * 
entry, WTexture ** texture
 
scr->icon_tile_pixmap = pixmap;
 
-   if (scr->def_icon_pixmap) {
-   XFreePixmap(dpy, scr->def_icon_pixmap);
-   scr->def_icon_pixmap = None;
-   }
-   if (scr->def_ticon_pixmap) {
-   XFreePixmap(dpy, scr->def_ticon_pixmap);
-   scr->def_ticon_pixmap = None;
+   if (scr->def_icon_rimage) {
+   RReleaseImage(scr->def_icon_rimage);
+   scr->def_icon_rimage = NULL;
}
 
-   if (scr->icon_back_texture) {
+   if (scr->icon_back_texture)
wTextureDestroy(scr, (WTexture *) scr->icon_back_texture);
-   }
+
scr->icon_back_texture = wTextureMakeSolid(scr, 
&((*texture)->any.color));
 
if (scr->clip_balloon)
diff --git a/src/icon.c b/src/icon.c
index 2739ca1..b0da0d8 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -628,28 +628,20 @@ void wIconUpdate(WIcon *icon)
 
 static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
-   RImage *image = NULL;
WScreen *scr = icon->core->screen_ptr;
 
+   /* If the icon has image, update it and continue */
if (icon->file_image) {
icon_update_pixmap(icon, icon->file_image);
-   } else {
-   /* make default icons */
-   if (!scr->def_icon_pixmap) {
-   image = get_default_image(scr);
-   scr->def_icon_pixmap = makeIcon(scr, image, False, 
False, icon->tile_type, icon->highlighted);
-   scr->def_ticon_pixmap = makeIcon(scr, image, True, 
False, icon->tile_type, icon->highlighted);
-   if (image)
-   RReleaseImage(image);
-   }
+   return;
+   }
 
-   if (icon->show_title)
-   XSetWindowBackgroundPixmap(dpy, icon->core->window, 
scr->def_ticon_pixmap);
-   else
-   XSetWindowBackgroundPixmap(dpy, icon->core->window, 
scr->def_icon_pixmap);
+   /* If the icon don't have image, we should use the default image. */
+   if (!scr->def_icon_rimage)
+   scr->def_icon_rimage = get_default_image(scr);
 
-   icon->pixmap = None;
-   }
+   /* Now, create the pixmap using the default (saved) image */
+   icon_update_pixmap(icon, scr->def_icon_rimage);
 }
 
 /* This function creates the RImage using the default icon */
diff --git a/src/screen.h b/src/screen.h
index f021096..dfdbd63 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -229,13 +229,12 @@ typedef struct _WScreen {
 
 struct RImage *icon_tile;
 struct RImage *clip_tile;
-Pixmap icon_tile_pixmap;  /* for app supplied icons */
 
-Pixmap def_icon_pixmap;   /* default icons */
-Pixmap def_ticon_pixmap;
+Pixmap icon_tile_pixmap;   /* For app supplied icons */
 
-struct WDialogData *dialog_data;
+struct RImage *def_icon_rimage;/* Default RImage icon */
 
+struct WDialogData *dialog_data;
 
 struct W_GeometryView *gview;  /* size/position view */
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 14/17] Function makeIcon removed

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function makeIcon is only used in icon_update_pixmap(), so
both functions can be joined. Now the function icon_update_pixmap()
includes the contents of makeIcon.
---
 src/icon.c |   23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index b0da0d8..791f8fb 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -64,9 +64,6 @@ static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
 
-static Pixmap makeIcon(WScreen *scr, RImage *image,
-  int titled, int shadowed,
-  int tileType, int highlighted);
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 
 static RImage *get_default_image(WScreen *scr);
@@ -274,23 +271,15 @@ static void drawIconTitle(WScreen * scr, Pixmap pixmap, 
int height)
 
 static void icon_update_pixmap(WIcon *icon, RImage *image)
 {
-   WScreen *scr = icon->core->screen_ptr;
-
-   /* Update the WIcon pixmap */
-   icon->pixmap = makeIcon(scr, image,
-   icon->show_title, icon->shadowed,
-   icon->tile_type, icon->highlighted);
-}
-
-static Pixmap makeIcon(WScreen *scr, RImage *image, int titled, int shadowed, 
int tileType, int highlighted)
-{
RImage *tile;
Pixmap pixmap;
int x, y, sx, sy;
unsigned w, h;
int theight = 0;
+   WScreen *scr = icon->core->screen_ptr;
+   int titled = icon->show_title;
 
-   if (tileType == TILE_NORMAL) {
+   if (icon->tile_type == TILE_NORMAL) {
tile = RCloneImage(scr->icon_tile);
} else {
assert(scr->clip_tile);
@@ -314,7 +303,7 @@ static Pixmap makeIcon(WScreen *scr, RImage *image, int 
titled, int shadowed, in
RCombineArea(tile, image, sx, sy, w, h, x, y);
}
 
-   if (shadowed) {
+   if (icon->shadowed) {
RColor color;
 
color.red = scr->icon_back_texture->light.red >> 8;
@@ -324,7 +313,7 @@ static Pixmap makeIcon(WScreen *scr, RImage *image, int 
titled, int shadowed, in
RClearImage(tile, &color);
}
 
-   if (highlighted) {
+   if (icon->highlighted) {
RColor color;
 
color.red = color.green = color.blue = 0;
@@ -340,7 +329,7 @@ static Pixmap makeIcon(WScreen *scr, RImage *image, int 
titled, int shadowed, in
if (titled)
drawIconTitle(scr, pixmap, theight);
 
-   return pixmap;
+   icon->pixmap = pixmap;
 }
 
 void wIconChangeTitle(WIcon * icon, char *new_title)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 16/17] Changed get_default_icon_rimage function name

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_default_icon_rimage name is not correct, because
the function doesn't return the default icon rimage, returns the
rimage from a file name. So the correct function name should be
get_rimage_from_file.
---
 src/defaults.h  |2 +-
 src/icon.c  |4 ++--
 src/wdefaults.c |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/defaults.h b/src/defaults.h
index 87ea8fb..2541f20 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -50,5 +50,5 @@ int wDefaultGetStartWorkspace(WScreen *scr, char *instance, 
char *class);
 void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
 char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, 
char *command,
Bool default_icon);
-RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size);
+RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
 #endif /* WMDEFAULTS_H_ */
diff --git a/src/icon.c b/src/icon.c
index 95ab568..b4ccfc5 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -142,7 +142,7 @@ WIcon *icon_create_for_wwindow(WWindow *wwin)
file = get_default_icon_filename(scr, wwin->wm_instance, 
wwin->wm_class, NULL, True);
if (file) {
icon->file = wstrdup(file);
-   icon->file_image = get_default_icon_rimage(scr, icon->file, 
wPreferences.icon_size);
+   icon->file_image = get_rimage_from_file(scr, icon->file, 
wPreferences.icon_size);
wfree(file);
}
 
@@ -167,7 +167,7 @@ WIcon *icon_create_for_dock(WScreen *scr, char *command, 
char *wm_instance, char
file = get_default_icon_filename(scr, wm_instance, wm_class, command, 
False);
if (file) {
icon->file = wstrdup(file);
-   icon->file_image = get_default_icon_rimage(scr, icon->file, 
wPreferences.icon_size);
+   icon->file_image = get_rimage_from_file(scr, icon->file, 
wPreferences.icon_size);
wfree(file);
}
 
diff --git a/src/wdefaults.c b/src/wdefaults.c
index c4cd819..8a4cdab 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -420,7 +420,7 @@ char *get_default_icon_filename(WScreen *scr, char 
*winstance, char *wclass, cha
 }
 
 /* This function returns the image picture for the file_name file */
-RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size)
+RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size)
 {
RImage *image = NULL;
 
@@ -446,7 +446,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, 
char *wclass, int max_s
if (!file_name)
return NULL;
 
-   return get_default_icon_rimage(scr, file_name, max_size);
+   return get_rimage_from_file(scr, file_name, max_size);
 }
 
 int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 12/17] New helper function get_default_image

2012-10-23 Thread kix
From: "Rodolfo García Peñas (kix)" 

The new function get_default_image creates a RImage with the default
icon. Now the function get_pixmap_icon_from_user_icon() is more clear
and show that, first try to get the user selected image, if not set,
then it gets the default icon.
---
 src/icon.c |   47 ++-
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index bb73c64..2739ca1 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -68,6 +68,8 @@ static Pixmap makeIcon(WScreen *scr, RImage *image,
   int titled, int shadowed,
   int tileType, int highlighted);
 static void icon_update_pixmap(WIcon *icon, RImage *image);
+
+static RImage *get_default_image(WScreen *scr);
 /** Notification Observers **/
 
 static void appearanceObserver(void *self, WMNotification * notif)
@@ -627,7 +629,6 @@ void wIconUpdate(WIcon *icon)
 static void get_pixmap_icon_from_user_icon(WIcon *icon)
 {
RImage *image = NULL;
-   char *path, *file;
WScreen *scr = icon->core->screen_ptr;
 
if (icon->file_image) {
@@ -635,22 +636,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon)
} else {
/* make default icons */
if (!scr->def_icon_pixmap) {
-   /* Get the default icon */
-   file = wDefaultGetIconFile(NULL, NULL, True);
-   if (file) {
-   path = FindImage(wPreferences.icon_path, file);
-   if (path) {
-   image = RLoadImage(scr->rcontext, path, 
0);
-   if (!image)
-   wwarning(_("could not load 
default icon \"%s\":%s"),
-file, 
RMessageForError(RErrorCode));
-   wfree(path);
-   } else {
-   wwarning(_("could not find default icon 
\"%s\""), file);
-   }
-   }
-
-   image = wIconValidateIconSize(image, 
wPreferences.icon_size);
+   image = get_default_image(scr);
scr->def_icon_pixmap = makeIcon(scr, image, False, 
False, icon->tile_type, icon->highlighted);
scr->def_ticon_pixmap = makeIcon(scr, image, True, 
False, icon->tile_type, icon->highlighted);
if (image)
@@ -666,6 +652,33 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon)
}
 }
 
+/* This function creates the RImage using the default icon */
+static RImage *get_default_image(WScreen *scr)
+{
+   RImage *image = NULL;
+   char *path, *file;
+
+   /* Get the default icon */
+   file = wDefaultGetIconFile(NULL, NULL, True);
+   if (file) {
+   path = FindImage(wPreferences.icon_path, file);
+   if (path) {
+   image = RLoadImage(scr->rcontext, path, 0);
+   if (!image)
+   wwarning(_("could not load default icon 
\"%s\":%s"),
+file, RMessageForError(RErrorCode));
+   wfree(path);
+   } else {
+   wwarning(_("could not find default icon \"%s\""), file);
+   }
+   }
+
+   /* Validate the icon size */
+   image = wIconValidateIconSize(image, wPreferences.icon_size);
+
+   return image;
+}
+
 /* Get the Pixmap from the WIcon of the WWindow */
 static void get_pixmap_icon_from_icon_win(WIcon * icon)
 {
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Two bugs - help

2012-10-24 Thread kix

On 2012-10-24 15:09, Carlos R. Mafra wrote:

On Wed, 24 Oct 2012 at  8:45:47 +0200, Rodolfo García Peñas wrote:


And, wmaker crash. Why? because IMO the code used to remove items
from the HastTables (domain database) is wrong. It removes the
item, but don't "removes the hole", then the next search in the
hashtable, returns the item in the "hole", a memory "no-item" 
(trash,
the " f"). The code is at WINGs/hashtable.c, functions 
WMHashRemove()

and deleteFromList(). Help is very appreciated. Probably you can
reproduce the problem renaming the defaultAppIcon.tiff image after
wmaker is up and launching a application without icon (declare a non
exist file in WMState file).


Does the crash happen without your patches too?


Yes.

I was working some months ago in this part, join the functions with 
RLoadImage in only one. The code of RImage 
*get_default_icon_rimage(WScreen *scr, char *file_name, int max_size) is 
used exactly in other functions at icon.c. When I tried to replace the 
dup code, I got the error. I left the analisys and I continued with 
other parts of the icon code, but now is time to solve it. These are the 
functions with dup code in the source:


For example:

Original function at wdefaults.c :
422 /* This function returns the image picture for the file_name file 
*/
423 RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int 
max_size)

424 {
425 RImage *image = NULL;
426
427 if (!file_name)
428 return NULL;
429
430 image = RLoadImage(scr->rcontext, file_name, 0);
431 if (!image)
432 wwarning(_("error loading image file \"%s\": %s"), file_name,
433 RMessageForError(RErrorCode));
434
435 image = wIconValidateIconSize(image, max_size);
436
437 return image;
438 }

At icon.c

613 void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon)
...
626 file = wDefaultGetIconFile(NULL, NULL, True);
627 if (file) {
628 path = FindImage(wPreferences.icon_path, file);
629 if (path) {
630 image = RLoadImage(scr->rcontext, path, 0);
631 if (!image)
632 wwarning(_("could not load default icon \"%s\":%s"),
633 file, RMessageForError(RErrorCode));
634 wfree(path);
635 } else {
636 wwarning(_("could not find default icon \"%s\""), file);
637 }
638 }
639
640 image = wIconValidateIconSize(image, wPreferences.icon_size);

and

365 Bool wIconChangeImageFile(WIcon * icon, char *file)
...
382 path = FindImage(wPreferences.icon_path, file);
383
384 if (path && (image = RLoadImage(scr->rcontext, path, 0))) {
385 icon->file_image = wIconValidateIconSize(image, 
wPreferences.icon_size);


About the hashtable, I think we need a "rebuildTable(table)" call at 
the end of WMHashRemove function, to re-create the hash table. I found 
it in my notes I wrote the first time I tried to remove the dup code. We 
need to check it.


The problem with full path, I didn't found info in my notes, so... I 
need more time... or more help.


Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] Debian configuration file error

2012-10-25 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch removes the extra commas in the configuration file
WindowMaker.

This bug was created in the commit 0e995bbf6ea91d8ff18009ce29219a171d92c808
but no debian packages were released.
---
 debian/debianfiles/conf/WindowMaker |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/debianfiles/conf/WindowMaker 
b/debian/debianfiles/conf/WindowMaker
index 3edaa0c..3d0bb75 100644
--- a/debian/debianfiles/conf/WindowMaker
+++ b/debian/debianfiles/conf/WindowMaker
@@ -14,7 +14,7 @@
 "/usr/local/share/WindowMaker/Icons",
 "/usr/share/WindowMaker/Icons",
 "/usr/local/share/icons",
-"/usr/share/icons",
+"/usr/share/icons"
   );
   PixmapPath = (
 "~/GNUstep/Library/WindowMaker/Pixmaps",
@@ -24,7 +24,7 @@
 "/usr/share/WindowMaker/Backgrounds",
 "/usr/share/WindowMaker/Pixmaps",
 "/usr/local/share/pixmaps",
-"/usr/share/pixmaps",
+"/usr/share/pixmaps"
   );
   WindowTitleBalloons = YES;
   IconSize = 64;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Debian maintainer for wmtime

2012-10-30 Thread kix

On 2012-10-30 12:21, Paul Harris wrote:

Hi guys,

Im going to step aside as maintainer of wmtime in the debian repo, I
just dont have the time unfortunately.

Its easy to maintain (since it works).  There are two patches pending
in the debian bugs db (that I didnt see until now), so bug fixing is
done for you!

Who wants to take over this delightful package?

cheers,
Paul


Hi Paul,

sorry, I don't have time for more packages. I can help to maintain the 
package if anyone wants to do it. Is a nice dockapp, please don't 
orphane it ;-)


OTOH this package is not in the dockapps.git. The idea is upload the 
original file and then upload the debian proposed patches. Can somebody 
do it?


Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Patch: Partial support for partial struts

2012-10-30 Thread kix

On 2012-10-30 16:42, Carlos R. Mafra wrote:

First of all: thanks for doing this, Iain!

On Tue, 30 Oct 2012 at  5:29:46 +, Iain Patterson wrote:


Subject: [PATCH 1/3] AppIcon helper functions.

Create wAppIconFor() and wAppIconTouchesHead() to match wWindowFor()
and wWindowTouchesHead().  These functions will allow us to locate 
the

window and head associated with a particular app icon or dock icon.



+WAppIcon *wAppIconFor(Window window)
+{
+   WObjDescriptor *desc;
+
+   if (window == None)
+   return NULL;
+
+	if (XFindContext(dpy, window, wWinContext, (XPointer *) & desc) == 
XCNOENT)

+   return NULL;
+
+	if (desc->parent_type == WCLASS_APPICON || desc->parent_type == 
WCLASS_DOCK_ICON)

+   return desc->parent;
+
+   return NULL;
+}


Perhaps it's just me, but I can't really get what the function does
from just reading its name: wAppIconFor(). I'm no native speaker, but
the "For" suffix confuses me. I wonder if wAppIconOf() would be more
"correct" -- ignoring the CamelCase issue :-)


This is used in other functions. I don't have wmaker source here, but 
the prototype is something like:


wAppIconFor(WWindow *wwin)

then you can read it as:

AppIcon for wwindow :-)

I don't like these function names!

I am changing the camel case too, we can see the code modified :-)

CamelCase: "Original" code
no_camel_case: New code :-P


I think there is a better name which clearly states its purpose.
I'm bad in choosing names, though.


I have a lot of monkeys typing here ;-)


I guess that justifies having some comment on top of the function
to state its purpose? I know it's a small function, but I find it
nicer to have an overview of what the function is supposed to do
before reading it.


Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


RE: Debian maintainer for wmtime

2012-10-30 Thread kix

On 2012-10-30 16:16, Doug Torrance wrote:

On 2012-10-30 12:21, Paul Harris wrote:



> Hi guys,
>
> Im going to step aside as maintainer of wmtime in the debian repo, 
I

> just dont have the time unfortunately.
>
> Its easy to maintain (since it works). There are two patches 
pending
> in the debian bugs db (that I didnt see until now), so bug fixing 
is

> done for you!
>
> Who wants to take over this delightful package?
>
> cheers,
> Paul

Hi Paul,

sorry, I don't have time for more packages. I can help to maintain 
the

package if anyone wants to do it. Is a nice dockapp, please don't
orphane it ;-)

OTOH this package is not in the dockapps.git. The idea is upload the
original file and then upload the debian proposed patches. Can 
somebody

do it?

Cheers,
kix
--
||// //\// Rodolfo "kix" Garcia
||\// //\ http://www.kix.es/


I can maintain it. I'll also upload it to git.

Doug Torrance


Thanks Doug,

there are more dockapps packages ready for adoption:

•wmacpi: ACPI battery monitor for WindowMaker (información del 
paquete), orphaned since 36 days.
•wmbatppc: Battery monitor for Apple G3/G4 ibooks/powerbooks 
(información del paquete), orphaned since 36 days.
•wmbubble: A system-load meter for Window Maker that features a duck 
(información del paquete), orphaned since 481 days.
•wmcdplay: A CD player based on ascd designed for WindowMaker 
(información del paquete), orphaned since 481 days.
•wmclock: dockable clock applet for Window Maker (información del 
paquete), orphaned since 36 days.
•wmhdplop: hard drive activity monitor dockapp (información del 
paquete), orphaned since today.
•wmnd: Dockapp monitoring network interfaces (información del paquete), 
orphaned since today.
•wmppp.app: PPP dial control and network load monitor with NeXTStep 
look (información del paquete), orphaned since 228 days.
•wmrack: Combined CD Player + Mixer designed for WindowMaker 
(información del paquete), orphaned since 228 days.


+info: http://www.debian.org/devel/wnpp/orphaned

Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/9] Removed dup code at get_default_image

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch removes the code dup at get_default_image. Now,
this function calls get_rimage_from_file()
---
 src/icon.c |   16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index b4ccfc5..da93679 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -649,19 +649,13 @@ static RImage *get_default_image(WScreen *scr)
file = wDefaultGetIconFile(NULL, NULL, True);
if (file) {
path = FindImage(wPreferences.icon_path, file);
-   if (path) {
-   image = RLoadImage(scr->rcontext, path, 0);
-   if (!image)
-   wwarning(_("could not load default icon 
\"%s\":%s"),
-file, RMessageForError(RErrorCode));
-   wfree(path);
-   } else {
+   image = get_rimage_from_file(scr, path, wPreferences.icon_size);
+
+   if (!image)
wwarning(_("could not find default icon \"%s\""), file);
-   }
-   }
 
-   /* Validate the icon size */
-   image = wIconValidateIconSize(image, wPreferences.icon_size);
+   wfree(file);
+   }
 
return image;
 }
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 3/9] wIconChangeImageFile removed dup code

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch removes the dup code with get_rimage_from_file.
---
 src/icon.c |   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 94d9567..0b95df2 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -369,10 +369,9 @@ RImage *wIconValidateIconSize(RImage *icon, int max_size)
return icon;
 }
 
-Bool wIconChangeImageFile(WIcon * icon, char *file)
+Bool wIconChangeImageFile(WIcon *icon, char *file)
 {
WScreen *scr = icon->core->screen_ptr;
-   RImage *image;
char *path;
int error = 0;
 
@@ -385,17 +384,20 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
}
 
path = FindImage(wPreferences.icon_path, file);
+   if (path) {
+   icon->file_image = get_rimage_from_file(scr, path, 
wPreferences.icon_size);
+   if (icon->file_image) {
+   icon->file = wstrdup(path);
+   wIconUpdate(icon);
+   } else {
+   error = 1;
+   }
 
-   if (path && (image = RLoadImage(scr->rcontext, path, 0))) {
-   icon->file_image = wIconValidateIconSize(image, 
wPreferences.icon_size);
-   wIconUpdate(icon);
+   wfree(path);
} else {
error = 1;
}
 
-   if (path)
-   wfree(path);
-
return !error;
 }
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 4/9] wIconChangeImageFile change image only if found

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch changes the behavior of wIconChangeImageFile.

Before apply this patch the behavior was:

The image (file_image) is set to NULL, then the function tried to find
a new image. If the new image was not found, the variable file_image contains
NULL when the function returns, and the return code was 1.

With this patch the image is changed only if a new image is found.
---
 src/icon.c |   32 
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 0b95df2..f693e77 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -373,31 +373,39 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
 {
WScreen *scr = icon->core->screen_ptr;
char *path;
+   RImage *image = NULL;
int error = 0;
 
+   /* If no new image, don't do nothing */
if (!file)
return True;
 
-   if (icon->file_image) {
-   RReleaseImage(icon->file_image);
-   icon->file_image = NULL;
-   }
-
+   /* Find the new image */
path = FindImage(wPreferences.icon_path, file);
-   if (path) {
-   icon->file_image = get_rimage_from_file(scr, path, 
wPreferences.icon_size);
+   if (path)
+   image = get_rimage_from_file(scr, path, wPreferences.icon_size);
+   else
+   error = 1;
+
+   /* New image! */
+   if (!error && image) {
+   /* Remove the old one */
if (icon->file_image) {
-   icon->file = wstrdup(path);
-   wIconUpdate(icon);
-   } else {
-   error = 1;
+   RReleaseImage(icon->file_image);
+   icon->file_image = NULL;
}
 
-   wfree(path);
+   /* Set the new image */
+   icon->file_image = image;
+   icon->file = wstrdup(path);
+   wIconUpdate(icon);
} else {
error = 1;
}
 
+   if (path)
+   wfree(path);
+
return !error;
 }
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/9] wIconChangeImageFile don't update without file

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wIconChangeImageFile mustn't update the icon if
no file is set.

This is a bug. To reproduce it:

1. Right click on dock icon. Select "Settings"
2. Erase the Icon Image contents (set empty)
3. Click "OK" -> Exit, no changes... no?
4. Right click on the same dock icon. Select "Settings"
5. Erase the Icon Image contents (set empty)
6. Click "OK" -> Crash

If wmaker don't crash, watch the file ~/GNUstep/Defaults/WMWindowAttributes,
the default icon ("*" has trash in the name). Probably something is not fine
at wIconUpdate.
---
 src/icon.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index da93679..94d9567 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -376,16 +376,14 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
char *path;
int error = 0;
 
+   if (!file)
+   return True;
+
if (icon->file_image) {
RReleaseImage(icon->file_image);
icon->file_image = NULL;
}
 
-   if (!file) {
-   wIconUpdate(icon);
-   return True;
-   }
-
path = FindImage(wPreferences.icon_path, file);
 
if (path && (image = RLoadImage(scr->rcontext, path, 0))) {
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 6/9] CachedPixmaps added as pixmap folder

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

The CachedPixmap folder is added to the icon list. This is because
if one icon is created, but the user change it and set other icon, the first
icon cannot be selected anymore using the settings window. The user
needs modify the configuration files by hand.

Some extra paths are added to the debian default config file.
---
 WindowMaker/Defaults/WindowMaker.in |2 ++
 debian/debianfiles/conf/WindowMaker |   19 ---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/WindowMaker/Defaults/WindowMaker.in 
b/WindowMaker/Defaults/WindowMaker.in
index 6b2890d..3e576be 100644
--- a/WindowMaker/Defaults/WindowMaker.in
+++ b/WindowMaker/Defaults/WindowMaker.in
@@ -14,6 +14,7 @@
 "#pkgdatadir#/Pixmaps",
 "/usr/include/X11/pixmaps",
 "~/GNUstep/Library/WindowMaker/Pixmaps",
+"~/GNUstep/Library/WindowMaker/CachedPixmaps",
 "/usr/share/icons",
 "/usr/local/share/pixmaps",
 "/usr/share/pixmaps"
@@ -21,6 +22,7 @@
   PixmapPath = (
 "~/GNUstep/Library/WindowMaker/Pixmaps",
 "~/GNUstep/Library/WindowMaker/Backgrounds",
+"~/GNUstep/Library/WindowMaker/CachedPixmaps",
 "#pkgdatadir#/Pixmaps",
 "#pkgdatadir#/Backgrounds",
 "/usr/include/X11/pixmaps",
diff --git a/debian/debianfiles/conf/WindowMaker 
b/debian/debianfiles/conf/WindowMaker
index 3d0bb75..cc36e7c 100644
--- a/debian/debianfiles/conf/WindowMaker
+++ b/debian/debianfiles/conf/WindowMaker
@@ -11,20 +11,25 @@
   IconificationStyle = Zoom;
   IconPath = (
 "~/GNUstep/Library/Icons",
-"/usr/local/share/WindowMaker/Icons",
+"~/GNUstep/Library/WindowMaker/Pixmaps",
+"~/GNUstep/Library/WindowMaker/CachedPixmaps",
 "/usr/share/WindowMaker/Icons",
-"/usr/local/share/icons",
-"/usr/share/icons"
+"/usr/share/WindowMaker/Pixmaps",
+"/usr/share/icons",
+"/usr/local/share/WindowMaker/Icons",
+"/usr/local/share/WindowMaker/Pixmaps",
+"/usr/local/share/icons"
   );
   PixmapPath = (
 "~/GNUstep/Library/WindowMaker/Pixmaps",
 "~/GNUstep/Library/WindowMaker/Backgrounds",
-"/usr/local/share/WindowMaker/Pixmaps",
-"/usr/local/share/WindowMaker/Backgrounds",
+"~/GNUstep/Library/WindowMaker/CachedPixmaps",
 "/usr/share/WindowMaker/Backgrounds",
 "/usr/share/WindowMaker/Pixmaps",
-"/usr/local/share/pixmaps",
-"/usr/share/pixmaps"
+"/usr/share/pixmaps",
+"/usr/local/share/WindowMaker/Pixmaps",
+"/usr/local/share/WindowMaker/Backgrounds",
+"/usr/local/share/pixmaps"
   );
   WindowTitleBalloons = YES;
   IconSize = 64;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 5/9] wIconChangeImageFile non negated value

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

The flag (declared as int, not Bool) "error" was negated in the return
sentences because is set to 1 when error. Is better set a positive flag,
like "ok_flag" (declared as Boolean, like the function returned value)
and set to False when error is found. The the function can return the
flag without negate it.
---
 src/icon.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index f693e77..cb69b00 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -374,21 +374,21 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
WScreen *scr = icon->core->screen_ptr;
char *path;
RImage *image = NULL;
-   int error = 0;
+   Bool ok_flag = True;
 
/* If no new image, don't do nothing */
if (!file)
-   return True;
+   return ok_flag;
 
/* Find the new image */
path = FindImage(wPreferences.icon_path, file);
if (path)
image = get_rimage_from_file(scr, path, wPreferences.icon_size);
else
-   error = 1;
+   ok_flag = False;
 
/* New image! */
-   if (!error && image) {
+   if (ok_flag && image) {
/* Remove the old one */
if (icon->file_image) {
RReleaseImage(icon->file_image);
@@ -400,13 +400,13 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
icon->file = wstrdup(path);
wIconUpdate(icon);
} else {
-   error = 1;
+   ok_flag = False;
}
 
if (path)
wfree(path);
 
-   return !error;
+   return ok_flag;
 }
 
 static char *get_name_for_wwin(WWindow *wwin)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 7/9] getSize returns XGetGeometry exit

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function getSize now returns the returned value by XGetGeometry.
The function now is not INLINE.
---
 src/icon.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index cb69b00..448332a 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -97,13 +97,13 @@ static void tileObserver(void *self, WMNotification * notif)
 
 //
 
-INLINE static void getSize(Drawable d, unsigned int *w, unsigned int *h, 
unsigned int *dep)
+static int getSize(Drawable d, unsigned int *w, unsigned int *h, unsigned int 
*dep)
 {
Window rjunk;
int xjunk, yjunk;
unsigned int bjunk;
 
-   XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
+   return XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
 }
 
 WIcon *icon_create_for_wwindow(WWindow *wwin)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 8/9] get_pixmap_icon_from_wm_hints uses getSize

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_wm_hints() now uses getSize() and
the code dup is removed.
---
 src/icon.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 448332a..26fe9b1 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -728,15 +728,14 @@ static void get_pixmap_icon_from_icon_win(WIcon * icon)
 /* Get the Pixmap from the XWindow wm_hints */
 static int get_pixmap_icon_from_wm_hints(WIcon *icon)
 {
-   Window jw;
Pixmap pixmap;
-   unsigned int w, h, ju, d;
-   int ji, x, y;
+   unsigned int w, h, d;
+   int x, y;
WWindow *wwin = icon->owner;
WScreen *scr = icon->core->screen_ptr;
int title_height = WMFontHeight(scr->icon_title_font);
 
-   if (!XGetGeometry(dpy, wwin->wm_hints->icon_pixmap, &jw, &ji, &ji, &w, 
&h, &ju, &d)) {
+   if (!getSize(wwin->wm_hints->icon_pixmap, &w, &h, &d)) {
icon->owner->wm_hints->flags &= ~IconPixmapHint;
return 1;
}
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 9/9] get_pixmap_icon_from_wm_hints rewrited

2012-10-31 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_wm_hints is now rewrited using
the functions get_wwindow_image_from_wmhints() and icon_update_pixmap().

Now, the function creates a new RImage using get_wwindow_image_from_wmhints()
and then update the Pixmap using the function icon_update_pixmap().
---
 src/icon.c |   50 ++
 1 file changed, 6 insertions(+), 44 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 26fe9b1..c21a13d 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -728,60 +728,22 @@ static void get_pixmap_icon_from_icon_win(WIcon * icon)
 /* Get the Pixmap from the XWindow wm_hints */
 static int get_pixmap_icon_from_wm_hints(WIcon *icon)
 {
-   Pixmap pixmap;
+   RImage *image = NULL;
unsigned int w, h, d;
-   int x, y;
WWindow *wwin = icon->owner;
-   WScreen *scr = icon->core->screen_ptr;
-   int title_height = WMFontHeight(scr->icon_title_font);
 
if (!getSize(wwin->wm_hints->icon_pixmap, &w, &h, &d)) {
icon->owner->wm_hints->flags &= ~IconPixmapHint;
return 1;
}
 
-   pixmap = XCreatePixmap(dpy, icon->core->window, wPreferences.icon_size,
-  wPreferences.icon_size, scr->w_depth);
-   XSetClipMask(dpy, scr->copy_gc, None);
-   XCopyArea(dpy, scr->icon_tile_pixmap, pixmap, scr->copy_gc, 0, 0,
- wPreferences.icon_size, wPreferences.icon_size, 0, 0);
-
-   if (w > wPreferences.icon_size)
-   w = wPreferences.icon_size;
-   x = (wPreferences.icon_size - w) / 2;
-
-   if (icon->show_title && (title_height < wPreferences.icon_size)) {
-   drawIconTitle(scr, pixmap, title_height);
-
-   if (h > wPreferences.icon_size - title_height - 2) {
-   h = wPreferences.icon_size - title_height - 2;
-   y = title_height + 1;
-   } else {
-   y = (wPreferences.icon_size - h - title_height) / 2 + 
title_height + 1;
-   }
-   } else {
-   if (w > wPreferences.icon_size)
-   w = wPreferences.icon_size;
-   y = (wPreferences.icon_size - h) / 2;
-   }
-
-   if (wwin->wm_hints->flags & IconMaskHint)
-   XSetClipMask(dpy, scr->copy_gc, wwin->wm_hints->icon_mask);
-
-   XSetClipOrigin(dpy, scr->copy_gc, x, y);
-
-   if (d != scr->w_depth) {
-   XSetForeground(dpy, scr->copy_gc, scr->black_pixel);
-   XSetBackground(dpy, scr->copy_gc, scr->white_pixel);
-   XCopyPlane(dpy, wwin->wm_hints->icon_pixmap, pixmap, 
scr->copy_gc, 0, 0, w, h, x, y, 1);
-   } else {
-   XCopyArea(dpy, wwin->wm_hints->icon_pixmap, pixmap, 
scr->copy_gc, 0, 0, w, h, x, y);
-   }
+   image = get_wwindow_image_from_wmhints(wwin, icon);
+   if (!image)
+   return 1;
 
-   XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
+   icon_update_pixmap(icon, image);
 
-   icon->pixmap = pixmap;
-   return (0);
+   return  0;
 }
 
 void wIconPaint(WIcon * icon)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Fwd: Work-needing packages report for Nov 2, 2012

2012-11-02 Thread kix

Hi,

these packages (I removed non-wmaker/gnustep packages) had been 
orphaned.


Cheers
kix

 Original Message 
Subject: Work-needing packages report for Nov 2, 2012
Date: 2012-11-02 01:25
From: w...@debian.org
To: debian-de...@lists.debian.org

The following is a listing of packages for which help has been 
requested

through the WNPP (Work-Needing and Prospective Packages) system in the
last week.

Total number of orphaned packages: 489 (new: 19)
Total number of packages offered up for adoption: 136 (new: 2)
Total number of packages requested help for: 62 (new: 0)

Please refer to http://www.debian.org/devel/wnpp/ for more information.



The following packages have been orphaned:

   aclock.app (#691819), orphaned 2 days ago
 Description: Analog dockapp clock for GNUstep
 Installations reported by Popcon: 72

   gridlock.app (#691825), orphaned 2 days ago
 Description: A collection of grid-based board games for GNUstep
 Installations reported by Popcon: 98

   talksoup.app (#691831), orphaned 2 days ago
 Description: IRC client for GNUstep
 Installations reported by Popcon: 203

   volumecontrol.app (#691832), orphaned 2 days ago
 Description: Audio mixer for GNUstep
 Installations reported by Popcon: 105

   wmhdplop (#691823), orphaned 2 days ago
 Description: hard drive activity monitor dockapp
 Installations reported by Popcon: 341

   wmnd (#691836), orphaned 2 days ago
 Description: Dockapp monitoring network interfaces
 Installations reported by Popcon: 210

See http://www.debian.org/devel/wnpp/help_requested for more 
information.


--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 02/14] wIconChangeImageFile non negated value

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The flag (declared as int, not Bool) "error" was negated in the return
sentences because is set to 1 when error. Is better set a positive flag,
like "ok_flag" (declared as Boolean, like the function returned value)
and set to False when error is found. The the function can return the
flag without negate it.
---
 src/icon.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index fce0a51..5fe444f 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -371,21 +371,21 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
WScreen *scr = icon->core->screen_ptr;
char *path;
RImage *image = NULL;
-   int error = 0;
+   Bool ok_flag = True;
 
/* If no new image, don't do nothing */
if (!file)
-   return True;
+   return ok_flag;
 
/* Find the new image */
path = FindImage(wPreferences.icon_path, file);
if (path)
image = get_rimage_from_file(scr, path, wPreferences.icon_size);
else
-   error = 1;
+   ok_flag = False;
 
/* New image! */
-   if (!error && image) {
+   if (ok_flag && image) {
/* Remove the old one */
unset_icon_image(icon);
 
@@ -394,13 +394,13 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
icon->file = wstrdup(path);
wIconUpdate(icon);
} else {
-   error = 1;
+   ok_flag = False;
}
 
if (path)
wfree(path);
 
-   return !error;
+   return ok_flag;
 }
 
 static char *get_name_for_wwin(WWindow *wwin)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 01/14] New helper function unset_icon_image()

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The new function unset_icon_image() removes the RImage and the
file path for a given icon.
---
 src/icon.c |   21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 018333b..fce0a51 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -66,6 +66,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon);
 static void get_pixmap_icon_from_default_icon(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
+static void unset_icon_image(WIcon *icon);
 
 static RImage *get_default_image(WScreen *scr);
 /** Notification Observers **/
@@ -251,11 +252,7 @@ void wIconDestroy(WIcon * icon)
if (icon->pixmap)
XFreePixmap(dpy, icon->pixmap);
 
-   if (icon->file)
-   wfree(icon->file);
-
-   if (icon->file_image != NULL)
-   RReleaseImage(icon->file_image);
+   unset_icon_image(icon);
 
wCoreDestroy(icon->core);
wfree(icon);
@@ -390,10 +387,7 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
/* New image! */
if (!error && image) {
/* Remove the old one */
-   if (icon->file_image) {
-   RReleaseImage(icon->file_image);
-   icon->file_image = NULL;
-   }
+   unset_icon_image(icon);
 
/* Set the new image */
icon->file_image = image;
@@ -585,6 +579,15 @@ void wIconSelect(WIcon * icon)
}
 }
 
+static void unset_icon_image(WIcon *icon)
+{
+   if (icon->file)
+   wfree(icon->file);
+
+   if (icon->file_image)
+   RReleaseImage(icon->file_image);
+}
+
 void wIconUpdate(WIcon *icon)
 {
WScreen *scr = icon->core->screen_ptr;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 04/14] rimage pixmap split *_icon_from_user_icon

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_user_icon() is splitted in two
functions now:

1. get_rimage_icon_from_user_icon, set the rimage at icon->image
   The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_user_icon() function, but now only converts
   the icon->file_image in icon->pixmap
---
 src/icon.c |   19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 89159c2..f65fc84 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,6 +63,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
+static void get_rimage_icon_from_user_icon(WIcon *icon);
 static void get_pixmap_icon_from_default_icon(WIcon *icon);
 static void get_rimage_icon_from_default_icon(WIcon *icon);
 
@@ -628,15 +629,21 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
 }
 
-static void get_pixmap_icon_from_user_icon(WIcon *icon)
+static void get_rimage_icon_from_user_icon(WIcon *icon)
 {
-   /* If the icon has image, update it and continue */
-   if (icon->file_image) {
-   icon_update_pixmap(icon, icon->file_image);
+   if (icon->file_image)
return;
-   }
 
-   get_pixmap_icon_from_default_icon(icon);
+   get_rimage_icon_from_default_icon(icon);
+}
+
+static void get_pixmap_icon_from_user_icon(WIcon *icon)
+{
+   /* Set the icon->file_image */
+   get_rimage_icon_from_user_icon(icon);
+
+   /* Update icon->pixmap */
+   icon_update_pixmap(icon, icon->file_image);
 }
 
 static void get_rimage_icon_from_default_icon(WIcon *icon)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 03/14] rimage pixmap split *_icon_from_default_icon

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_default_icon() is splitted in two
functions now:

1. get_rimage_icon_from_default_icon, set the rimage at icon->image
   The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_default_icon(), but now only converts
   the icon->file_image in icon->pixmap
---
 src/icon.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 5fe444f..89159c2 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -64,6 +64,7 @@ static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
 static void get_pixmap_icon_from_default_icon(WIcon *icon);
+static void get_rimage_icon_from_default_icon(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 static void unset_icon_image(WIcon *icon);
@@ -638,7 +639,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon)
get_pixmap_icon_from_default_icon(icon);
 }
 
-static void get_pixmap_icon_from_default_icon(WIcon *icon)
+static void get_rimage_icon_from_default_icon(WIcon *icon)
 {
WScreen *scr = icon->core->screen_ptr;
 
@@ -646,8 +647,21 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon)
if (!scr->def_icon_rimage)
scr->def_icon_rimage = get_default_image(scr);
 
+   /* Remove the icon image */
+   unset_icon_image(icon);
+
+   /* Set the new icon image */
+   icon->file = NULL;
+   icon->file_image = RRetainImage(scr->def_icon_rimage);
+}
+
+static void get_pixmap_icon_from_default_icon(WIcon *icon)
+{
+   /* Update icon->file image */
+   get_rimage_icon_from_default_icon(icon);
+
/* Now, create the pixmap using the default (saved) image */
-   icon_update_pixmap(icon, scr->def_icon_rimage);
+   icon_update_pixmap(icon, icon->file_image);
 }
 
 /* This function creates the RImage using the default icon */
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 05/14] rimage pixmap split *_icon_from_wm_hints

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_wm_hints() is splitted in two
functions now:

1. get_rimage_icon_from_wm_hints, set the rimage at icon->image
   The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_wm_hints() function, but now only converts
   the icon->file_image in icon->pixmap
---
 src/icon.c |   23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index f65fc84..6332afe 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -62,6 +62,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 
 static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
+static int get_rimage_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
 static void get_pixmap_icon_from_default_icon(WIcon *icon);
@@ -749,8 +750,8 @@ static void get_pixmap_icon_from_icon_win(WIcon * icon)
  None, wCursor[WCUR_ARROW]);
 }
 
-/* Get the Pixmap from the XWindow wm_hints */
-static int get_pixmap_icon_from_wm_hints(WIcon *icon)
+/* Get the RImage from the XWindow wm_hints */
+static int get_rimage_icon_from_wm_hints(WIcon *icon)
 {
RImage *image = NULL;
unsigned int w, h, d;
@@ -765,9 +766,23 @@ static int get_pixmap_icon_from_wm_hints(WIcon *icon)
if (!image)
return 1;
 
-   icon_update_pixmap(icon, image);
+   /* FIXME: If unset_icon_image, pointer double free then crash 
+   unset_icon_image(icon); */
+   icon->file_image = image;
+
+   return 0;
+}
+
+/* Get the Pixmap from the XWindow wm_hints */
+static int get_pixmap_icon_from_wm_hints(WIcon *icon)
+{
+   int ret;
+
+   ret = get_rimage_icon_from_wm_hints(icon);
+   if (ret == 0)
+   icon_update_pixmap(icon, icon->file_image);
 
-   return  0;
+   return ret;
 }
 
 void wIconPaint(WIcon * icon)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 06/14] New functions get_*_icon_from_x11

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

A new functions get_pixmap_icon_from_x11 and get_rimage_icon_from_x11
are included in icon.h

1. get_pixmap_icon_from_x11, set the rimage at icon->file_image
   The code sets net_icon_image in icon->file_image
2. The get_rimage_icon_from_x11 function, only converts
   the icon->file_image in icon->pixmap
---
 src/icon.c |   23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/icon.c b/src/icon.c
index 6332afe..14c287f 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -67,6 +67,8 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
 static void get_pixmap_icon_from_default_icon(WIcon *icon);
 static void get_rimage_icon_from_default_icon(WIcon *icon);
+static void get_pixmap_icon_from_x11(WIcon *icon);
+static void get_rimage_icon_from_x11(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 static void unset_icon_image(WIcon *icon);
@@ -611,7 +613,7 @@ void wIconUpdate(WIcon *icon)
get_pixmap_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
/* Use _NET_WM_ICON icon */
-   icon_update_pixmap(icon, wwin->net_icon_image);
+   get_pixmap_icon_from_x11(icon);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & 
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
if (get_pixmap_icon_from_wm_hints(icon))
@@ -630,6 +632,25 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
 }
 
+static void get_pixmap_icon_from_x11(WIcon *icon)
+{
+   /* Set the icon->file_image */
+   get_rimage_icon_from_x11(icon);
+
+   /* Update icon->pixmap */
+   icon_update_pixmap(icon, icon->file_image);
+}
+
+static void get_rimage_icon_from_x11(WIcon *icon)
+{
+   /* Remove the icon image */
+   unset_icon_image(icon);
+
+   /* Set the new icon image */
+   icon->file = NULL;
+   icon->file_image = RRetainImage(icon->owner->net_icon_image);
+}
+
 static void get_rimage_icon_from_user_icon(WIcon *icon)
 {
if (icon->file_image)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 07/14] get_window_image_from_x11 now with Window

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_wwindow_image_from_x11() is now get_window_image_from_x11()
and do the same work, but now the argument is a Window struct, not a WWindow.
This change is better, because allow to objects with Windows, but without
WWindows, call this function.

The function now is not static, to allow use it in other parts of the code.
---
 src/wmspec.c |6 +++---
 src/wmspec.h |1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index 6bd51ce..b3dfb8b 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -420,7 +420,7 @@ static RImage *makeRImageFromARGBData(unsigned long *data)
return image;
 }
 
-static RImage *get_wwindow_image_from_x11(WWindow *wwin)
+RImage *get_window_image_from_x11(Window window)
 {
RImage *image;
Atom type;
@@ -429,7 +429,7 @@ static RImage *get_wwindow_image_from_x11(WWindow *wwin)
unsigned long *property, *data;
 
/* Get the icon from X11 Window */
-   if (XGetWindowProperty(dpy, wwin->client_win, net_wm_icon, 0L, LONG_MAX,
+   if (XGetWindowProperty(dpy, window, net_wm_icon, 0L, LONG_MAX,
   False, XA_CARDINAL, &type, &format, &items, 
&rest,
   (unsigned char **)&property) != Success || 
!property)
return NULL;
@@ -464,7 +464,7 @@ static void updateIconImage(WWindow *wwin)
RReleaseImage(wwin->net_icon_image);
 
/* Save the icon in the X11 icon */
-   wwin->net_icon_image = get_wwindow_image_from_x11(wwin);
+   wwin->net_icon_image = get_window_image_from_x11(wwin->client_win);
 
/* Refresh the Window Icon */
if (wwin->icon)
diff --git a/src/wmspec.h b/src/wmspec.h
index 63d1eff..5bb26f0 100644
--- a/src/wmspec.h
+++ b/src/wmspec.h
@@ -45,4 +45,5 @@ char *wNETWMGetIconName(Window window);
 char *wNETWMGetWindowName(Window window);
 void wNETFrameExtents(WWindow *wwin);
 void wNETCleanupFrameExtents(WWindow *wwin);
+RImage *get_window_image_from_x11(Window window);
 #endif
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 08/14] get_pixmap_icon_from_icon_win rewrited

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_icon_win() is now rewrited.

This function now creates the icon using the function 
get_window_image_from_x11(),
using itself as Window and update the icon using icon_update_pixmap().

At this point the Pixmap is only the icon background. Now we must put inside the
dockapp, in the correct position. Then the funcion get the dock application 
size,
(the max size is wPreferences.icon_size, because get_window_image_from_x11() 
checks
the valid size), check if the icon has title and then reparent the dockapp to 
put
it inside the icon.

This patch includes a lot of comments to better code understanding.
---
 src/icon.c |   70 ++--
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 14c287f..46b9a79 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -715,60 +715,60 @@ static RImage *get_default_image(WScreen *scr)
 }
 
 /* Get the Pixmap from the WIcon of the WWindow */
-static void get_pixmap_icon_from_icon_win(WIcon * icon)
+static void get_pixmap_icon_from_icon_win(WIcon *icon)
 {
XWindowAttributes attr;
+   RImage *image;
WScreen *scr = icon->core->screen_ptr;
int title_height = WMFontHeight(scr->icon_title_font);
-   unsigned int width, height, depth;
-   int theight;
-   int resize = 0;
-   Pixmap pixmap;
+   unsigned int w, h, d;
+   int theight = 0;
 
-   getSize(icon->icon_win, &width, &height, &depth);
+   /* Create the new RImage */
+   image = get_window_image_from_x11(icon->icon_win);
 
-   if (width > wPreferences.icon_size) {
-   resize = 1;
-   width = wPreferences.icon_size;
-   }
+   /* Free the icon info */
+   unset_icon_image(icon);
 
-   if (height > wPreferences.icon_size) {
-   resize = 1;
-   height = wPreferences.icon_size;
-   }
+   /* Set the new info */
+   icon->file = NULL;
+   icon->file_image = image;
 
-   if (icon->show_title && (height + title_height < 
wPreferences.icon_size)) {
-   pixmap = XCreatePixmap(dpy, scr->w_win, wPreferences.icon_size,
-  wPreferences.icon_size, scr->w_depth);
-   XSetClipMask(dpy, scr->copy_gc, None);
-   XCopyArea(dpy, scr->icon_tile_pixmap, pixmap, scr->copy_gc, 0, 
0,
- wPreferences.icon_size, wPreferences.icon_size, 0, 0);
-   drawIconTitle(scr, pixmap, title_height);
+   /* Paint the image at the icon */
+   icon_update_pixmap(icon, image);
+
+   /* Reparent the dock application to the icon */
+
+   /* We need the application size to center it
+* and show in the correct position */
+   getSize(icon->icon_win, &w, &h, &d);
+
+   /* Set extra space for title */
+   if (icon->show_title && (h + title_height < wPreferences.icon_size)) {
theight = title_height;
-   } else {
-   pixmap = None;
-   theight = 0;
-   XSetWindowBackgroundPixmap(dpy, icon->core->window, 
scr->icon_tile_pixmap);
+   drawIconTitle(scr, icon->pixmap, theight);
}
 
+   /* Now is time to do the work */
+
+   /* Set the icon border */
XSetWindowBorderWidth(dpy, icon->icon_win, 0);
+
+   /* Put the dock application in the icon */
XReparentWindow(dpy, icon->icon_win, icon->core->window,
-   (wPreferences.icon_size - width) / 2,
-   theight + (wPreferences.icon_size - height - theight) / 
2);
-   if (resize)
-   XResizeWindow(dpy, icon->icon_win, width, height);
+   (wPreferences.icon_size - w) / 2,
+   theight + (wPreferences.icon_size - h - theight) / 2);
 
+   /* Show it and save */
XMapWindow(dpy, icon->icon_win);
XAddToSaveSet(dpy, icon->icon_win);
 
-   /* Save it */
-   icon->pixmap = pixmap;
-
+   /* Needed to move the icon clicking on the application part */
if ((XGetWindowAttributes(dpy, icon->icon_win, &attr)) &&
(attr.all_event_masks & ButtonPressMask))
-   wHackedGrabButton(Button1, MOD_MASK, 
icon->core->window, True,
- ButtonPressMask, GrabModeSync, 
GrabModeAsync,
- None, wCursor[WCUR_ARROW]);
+   wHackedGrabButton(Button1, MOD_MASK, icon->core->window, True,
+ ButtonPressMask, GrabModeSync, GrabModeAsync,
+ None, wCursor[WCUR_ARROW]);
 }
 
 /* Get the RImage from the XWindow wm_hints */
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 09/14] Solved bug if icon doesn't exists

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

There is a but in wmaker with icon files set in config files, but
that doesn't exist in the disk. For example, if the config files have:

etc/WindowMaker/WMWindowAttributes:
  xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
share/WindowMaker/IconSets/Default.iconset:
  xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};

But the icon "HP-16C-48.xpm" doesn't exist in the disk, wmaker do:

1. Load the config file in memory, in a database
2. When the application is launched, wmaker try to find their icon in
   the database (using wDefaultGetIconFile), the icon is found: HP-16C-48.xpm
3. When WindowMaker try to find the full path for the icon, using FindImage(),
   WindowMaker cannot find the icon, and returns NULL.
   Even, if the user set the default_icon boolean variable to True, wmaker
   finds in the database the wrong icon.

This patch check that the icon exist, in the database AND in the disk. If the
icon doesn't exist in the disk, and the default_icon variable is set to True,
then windowmaker load the default icon, using the function get_default_image()
because this function search the default icon directly.

The function get_default_image() is moved from icon.c to wdefaults.c because
is now used in both places. This function is now splitted, to find the file
(get_default_image_path) path and the file image (get_default_image)
---
 src/defaults.h  |2 ++
 src/icon.c  |   22 --
 src/wdefaults.c |   53 +
 3 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/src/defaults.h b/src/defaults.h
index 2541f20..4104f84 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -41,6 +41,7 @@ void wDefaultFillAttributes(char *instance, char *class,
 WWindowAttributes *attr, WWindowAttributes *mask,
 Bool useGlobalDefault);
 
+char *get_default_image_path(WScreen *scr);
 char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon);
 
 RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int 
max_size);
@@ -48,6 +49,7 @@ RImage * wDefaultGetImage(WScreen *scr, char *winstance, char 
*wclass, int max_s
 
 int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
 void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
+RImage *get_default_image(WScreen *scr);
 char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, 
char *command,
Bool default_icon);
 RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
diff --git a/src/icon.c b/src/icon.c
index 46b9a79..20b7303 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -73,7 +73,6 @@ static void get_rimage_icon_from_x11(WIcon *icon);
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 static void unset_icon_image(WIcon *icon);
 
-static RImage *get_default_image(WScreen *scr);
 /** Notification Observers **/
 
 static void appearanceObserver(void *self, WMNotification * notif)
@@ -693,27 +692,6 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon)
icon_update_pixmap(icon, icon->file_image);
 }
 
-/* This function creates the RImage using the default icon */
-static RImage *get_default_image(WScreen *scr)
-{
-   RImage *image = NULL;
-   char *path, *file;
-
-   /* Get the default icon */
-   file = wDefaultGetIconFile(NULL, NULL, True);
-   if (file) {
-   path = FindImage(wPreferences.icon_path, file);
-   image = get_rimage_from_file(scr, path, wPreferences.icon_size);
-
-   if (!image)
-   wwarning(_("could not find default icon \"%s\""), file);
-
-   wfree(file);
-   }
-
-   return image;
-}
-
 /* Get the Pixmap from the WIcon of the WWindow */
 static void get_pixmap_icon_from_icon_win(WIcon *icon)
 {
diff --git a/src/wdefaults.c b/src/wdefaults.c
index 8a4cdab..532b19e 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -385,11 +385,15 @@ char *get_default_icon_filename(WScreen *scr, char 
*winstance, char *wclass, cha
/* Get the file name of the image, using instance and class */
file_name = wDefaultGetIconFile(winstance, wclass, default_icon);
 
+   /* Check if the file really exists in the disk */
+   if (file_name)
+   file_path = FindImage(wPreferences.icon_path, file_name);
+
/* If the specific (or generic if default_icon is True) icon filename
 * is not found, and command is specified, then include the .app icons
 * and re-do the search, but now always including the default icon
 * so the icon is found always. The .app is selected before default */
-   if (!file_name && scr && command) {
+   if ((!file_name || !file_path ) &

[PATCH 10/14] rimage pixmap split *_icon_from_icon_win

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_pixmap_icon_from_icon_win(), before this patch,
creates the pixmap icon for dockapps (docks with a mini application
inside). The function did three steps:

1. Create the (r)image
2. Create the pixmap using the image
3. Put the application inside the image

Now these three steps are three functions:

step 1: static void get_rimage_icon_from_icon_win(WIcon *icon);
step 2: static void get_pixmap_icon_from_icon_win(WIcon *icon);
step 3: static void set_dockapp_in_icon(WIcon *icon);

These functions contains the same code, that before the changes.
The original function get_pixmap_icon_from_icon_win() includes the
calls to the new functions get_rimage_icon_from_icon_win() and
set_dockapp_in_icon()
---
 src/icon.c |   33 +
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 20b7303..5b28439 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -60,7 +60,9 @@ static void miniwindowDblClick(WObjDescriptor * desc, XEvent 
* event);
 
 static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y);
 
+static void set_dockapp_in_icon(WIcon *icon);
 static void get_pixmap_icon_from_icon_win(WIcon *icon);
+static void get_rimage_icon_from_icon_win(WIcon *icon);
 static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static int get_rimage_icon_from_wm_hints(WIcon *icon);
 static void get_pixmap_icon_from_user_icon(WIcon *icon);
@@ -692,15 +694,10 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon)
icon_update_pixmap(icon, icon->file_image);
 }
 
-/* Get the Pixmap from the WIcon of the WWindow */
-static void get_pixmap_icon_from_icon_win(WIcon *icon)
+/* Get the RImage from the WIcon of the WWindow */
+static void get_rimage_icon_from_icon_win(WIcon *icon)
 {
-   XWindowAttributes attr;
RImage *image;
-   WScreen *scr = icon->core->screen_ptr;
-   int title_height = WMFontHeight(scr->icon_title_font);
-   unsigned int w, h, d;
-   int theight = 0;
 
/* Create the new RImage */
image = get_window_image_from_x11(icon->icon_win);
@@ -711,9 +708,29 @@ static void get_pixmap_icon_from_icon_win(WIcon *icon)
/* Set the new info */
icon->file = NULL;
icon->file_image = image;
+}
+
+/* Get the Pixmap from the WIcon of the WWindow */
+static void get_pixmap_icon_from_icon_win(WIcon *icon)
+{
+   /* Get the RImage and set in icon->file_image */
+   get_rimage_icon_from_icon_win(icon);
 
/* Paint the image at the icon */
-   icon_update_pixmap(icon, image);
+   icon_update_pixmap(icon, icon->file_image);
+
+   /* Put the dockapp in the icon */
+   set_dockapp_in_icon(icon);
+}
+
+/* Set the dockapp in the WIcon */
+static void set_dockapp_in_icon(WIcon *icon)
+{
+   XWindowAttributes attr;
+   WScreen *scr = icon->core->screen_ptr;
+   int title_height = WMFontHeight(scr->icon_title_font);
+   unsigned int w, h, d;
+   int theight = 0;
 
/* Reparent the dock application to the icon */
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 13/14] wIconSetHighlited doesn't create icon

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wIconSetHighlited() is now faster, because don't
re-create the icon before set the Highlited status. Now only
draw the icon pixmap.
---
 src/icon.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index fe52a09..ff29484 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -554,8 +554,7 @@ void wIconSetHighlited(WIcon *icon, Bool flag)
return;
 
icon->highlighted = flag;
-   icon->force_paint = True;
-   wIconPaint(icon);
+   update_icon_pixmap(icon);
 }
 #endif
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 14/14] appearanceObserver doesn't create icon

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function appearanceObserver() is now faster, because don't
re-create the icon. Now only draw the icon pixmap.
---
 src/icon.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index ff29484..d4268c1 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -72,15 +72,20 @@ static void unset_icon_image(WIcon *icon);
 
 /** Notification Observers **/
 
-static void appearanceObserver(void *self, WMNotification * notif)
+static void appearanceObserver(void *self, WMNotification *notif)
 {
WIcon *icon = (WIcon *) self;
uintptr_t flags = (uintptr_t)WMGetNotificationClientData(notif);
 
-   if ((flags & WTextureSettings) || (flags & WFontSettings))
-   icon->force_paint = 1;
+   printf("appearanceObserver\n");
 
-   wIconPaint(icon);
+   if ((flags & WTextureSettings) || (flags & WFontSettings)) {
+   /* If the rimage exists, update the icon, else create it */
+   if (icon->file_image)
+   update_icon_pixmap(icon);
+   else
+   wIconPaint(icon);
+   }
 
/* so that the appicon expose handlers will paint the appicon specific
 * stuff */
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 11/14] wIconUpdate create rimage and then pixmap

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wIconUpdate now create the rimage for the icon, using
different functions. When the icon is created, then the pixmap is
generated using this rimage.
---
 src/icon.c |   90 +++-
 1 file changed, 22 insertions(+), 68 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 5b28439..7548699 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -61,15 +61,10 @@ static void miniwindowDblClick(WObjDescriptor * desc, 
XEvent * event);
 static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y);
 
 static void set_dockapp_in_icon(WIcon *icon);
-static void get_pixmap_icon_from_icon_win(WIcon *icon);
 static void get_rimage_icon_from_icon_win(WIcon *icon);
-static int get_pixmap_icon_from_wm_hints(WIcon *icon);
 static int get_rimage_icon_from_wm_hints(WIcon *icon);
-static void get_pixmap_icon_from_user_icon(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
-static void get_pixmap_icon_from_default_icon(WIcon *icon);
 static void get_rimage_icon_from_default_icon(WIcon *icon);
-static void get_pixmap_icon_from_x11(WIcon *icon);
 static void get_rimage_icon_from_x11(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
@@ -601,27 +596,38 @@ void wIconUpdate(WIcon *icon)
 
assert(scr->icon_tile != NULL);
 
-   if (icon->pixmap != None)
-   XFreePixmap(dpy, icon->pixmap);
-
-   icon->pixmap = None;
-
if (wwin && WFLAGP(wwin, always_user_icon)) {
/* Forced use user_icon */
-   get_pixmap_icon_from_user_icon(icon);
+   get_rimage_icon_from_user_icon(icon);
} else if (icon->icon_win != None) {
/* Get the Pixmap from the WIcon */
-   get_pixmap_icon_from_icon_win(icon);
+   get_rimage_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
/* Use _NET_WM_ICON icon */
-   get_pixmap_icon_from_x11(icon);
+   get_rimage_icon_from_x11(icon);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & 
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
-   if (get_pixmap_icon_from_wm_hints(icon))
-   get_pixmap_icon_from_user_icon(icon);
+   if (get_rimage_icon_from_wm_hints(icon))
+   get_rimage_icon_from_user_icon(icon);
} else {
/* Get the Pixmap from the user */
-   get_pixmap_icon_from_user_icon(icon);
+   get_rimage_icon_from_user_icon(icon);
+   }
+
+   if (icon->pixmap != None)
+   XFreePixmap(dpy, icon->pixmap);
+
+   icon->pixmap = None;
+ 
+   /* Create the pixmap */
+   if (icon->file_image)
+   icon_update_pixmap(icon, icon->file_image);
+
+   /* If dockapp, put inside the icon */
+   if (icon->icon_win != None) {
+   /* file_image is NULL, because is docked app */
+   icon_update_pixmap(icon, icon->file_image);
+   set_dockapp_in_icon(icon);
}
 
/* No pixmap, set default background */
@@ -633,15 +639,6 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
 }
 
-static void get_pixmap_icon_from_x11(WIcon *icon)
-{
-   /* Set the icon->file_image */
-   get_rimage_icon_from_x11(icon);
-
-   /* Update icon->pixmap */
-   icon_update_pixmap(icon, icon->file_image);
-}
-
 static void get_rimage_icon_from_x11(WIcon *icon)
 {
/* Remove the icon image */
@@ -660,15 +657,6 @@ static void get_rimage_icon_from_user_icon(WIcon *icon)
get_rimage_icon_from_default_icon(icon);
 }
 
-static void get_pixmap_icon_from_user_icon(WIcon *icon)
-{
-   /* Set the icon->file_image */
-   get_rimage_icon_from_user_icon(icon);
-
-   /* Update icon->pixmap */
-   icon_update_pixmap(icon, icon->file_image);
-}
-
 static void get_rimage_icon_from_default_icon(WIcon *icon)
 {
WScreen *scr = icon->core->screen_ptr;
@@ -685,15 +673,6 @@ static void get_rimage_icon_from_default_icon(WIcon *icon)
icon->file_image = RRetainImage(scr->def_icon_rimage);
 }
 
-static void get_pixmap_icon_from_default_icon(WIcon *icon)
-{
-   /* Update icon->file image */
-   get_rimage_icon_from_default_icon(icon);
-
-   /* Now, create the pixmap using the default (saved) image */
-   icon_update_pixmap(icon, icon->file_image);
-}
-
 /* Get the RImage from the WIcon of the WWindow */
 static void get_rimage_icon_from_icon_win(WIcon *icon)
 {
@@ -710,19 +689,6 @@ static void get_rimage_icon_from_icon_win(WIcon *icon)
icon->file_image = image;
 }
 
-/* Get the Pixmap from the WIcon of the WWindow */
-static void get_pixmap_icon_from_icon_win(WIcon *

[PATCH 12/14] New function update_icon_pixmap

2012-11-03 Thread kix
From: "Rodolfo García Peñas (kix)" 

The new function update_icon_pixmap do the update pixmap for a icon task.
Now, wIconCreate creates the image and set the icon->file and icon->file_image
variables, but update_icon_pixmap updates the icon->pixmap.

This is so interesting because we can update the pixmaps without create the
image again.
---
 src/icon.c |5 +
 src/icon.h |1 +
 2 files changed, 6 insertions(+)

diff --git a/src/icon.c b/src/icon.c
index 7548699..fe52a09 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -614,6 +614,11 @@ void wIconUpdate(WIcon *icon)
get_rimage_icon_from_user_icon(icon);
}
 
+   update_icon_pixmap(icon);
+}
+
+void update_icon_pixmap(WIcon *icon)
+{
if (icon->pixmap != None)
XFreePixmap(dpy, icon->pixmap);
 
diff --git a/src/icon.h b/src/icon.h
index f0786cb..48cf58b 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -62,6 +62,7 @@ void wIconPaint(WIcon *icon);
 void wIconUpdate(WIcon *icon);
 void wIconSelect(WIcon *icon);
 void wIconChangeTitle(WIcon *icon, char *new_title);
+void update_icon_pixmap(WIcon *icon);
 
 Bool wIconChangeImageFile(WIcon *icon, char *file);
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 0/4] Icon cleaning patches

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

These patches are independent, but all made some code cleanups.

0001-wDockAttachIcon-icon_editing-is-common-in-if-else.patch

This is a simple patch:

if (1) {
 a;
 b;
} else {
 a;
 c;
}

is better as:

a;
if (1)
 b
else
 c

0002-get_default_icon_filename-rewrited.patch

This patch is very interesting. See their description because is too long.
It solves some bugs with icon errors at config file. See your logs now!

This patch also rename the function from get_default_icon_filename() to
get_icon_filename(). Shorter, easiest.

0003-wDefaultGetImage-renamed-to-get_icon_image.patch

To hold the same idea that the before patch, this change the name from
wDefaultGetImage() to get_icon_image().

0004-get_default_image_path-unused-argument.patch

The Screen argument is not used in the function, so can be removed.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 3/4] wDefaultGetImage renamed to get_icon_image

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wDefaultGetImage is renamed to get_icon_image.
---
 src/defaults.h|9 +
 src/screen.c  |2 +-
 src/switchpanel.c |4 ++--
 src/wdefaults.c   |2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/defaults.h b/src/defaults.h
index e834c5a..197b9ab 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -42,15 +42,16 @@ void wDefaultFillAttributes(char *instance, char *class,
 Bool useGlobalDefault);
 
 char *get_default_image_path(WScreen *scr);
+RImage *get_default_image(WScreen *scr);
+
 char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon);
 
-RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int 
max_size);
+RImage *get_icon_image(WScreen *scr, char *winstance, char *wclass, int 
max_size);
+char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char 
*command,
+   Bool default_icon);
 
 
 int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
 void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
-RImage *get_default_image(WScreen *scr);
-char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char 
*command,
-   Bool default_icon);
 RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
 #endif /* WMDEFAULTS_H_ */
diff --git a/src/screen.c b/src/screen.c
index 2efe7c3..1ba325c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -413,7 +413,7 @@ static void createPixmaps(WScreen * scr)
 
 void create_logo_image(WScreen *scr)
 {
-   RImage *image = wDefaultGetImage(scr, "Logo", "WMPanel", 
wPreferences.icon_size);
+   RImage *image = get_icon_image(scr, "Logo", "WMPanel", 
wPreferences.icon_size);
 
if (!image) {
wwarning(_("could not load logo image for panels: %s"), 
RMessageForError(RErrorCode));
diff --git a/src/switchpanel.c b/src/switchpanel.c
index 5006bce..ca2994c 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -161,9 +161,9 @@ static void addIconForWindow(WSwitchPanel *panel, WMWidget 
*parent, WWindow *wwi
if (!WFLAGP(wwin, always_user_icon) && wwin->net_icon_image)
image = RRetainImage(wwin->net_icon_image);
 
-   /* wDefaultGetImage() includes the default icon image */
+   /* get_icon_image() includes the default icon image */
if (!image)
-   image = wDefaultGetImage(panel->scr, wwin->wm_instance, 
wwin->wm_class, ICON_TILE_SIZE);
+   image = get_icon_image(panel->scr, wwin->wm_instance, 
wwin->wm_class, ICON_TILE_SIZE);
 
/* We must resize the icon size (~64) to the switchpanel icon size 
(~48) */
image = wIconValidateIconSize(image, ICON_SIZE);
diff --git a/src/wdefaults.c b/src/wdefaults.c
index a342369..485 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -469,7 +469,7 @@ RImage *get_default_image(WScreen *scr)
return image;
 }
 
-RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int 
max_size)
+RImage *get_icon_image(WScreen *scr, char *winstance, char *wclass, int 
max_size)
 {
char *file_name = NULL;
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/4] wDockAttachIcon icon_editing is common in if else

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The line "icon_editing = 0" is the first line in the "if" sentence
and the first (and only) sentence in the "else" block, so can be
moved outside the if-else (and the empty else block can be removed).
---
 src/dock.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index c90ae93..58ef31a 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -1854,11 +1854,11 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int 
x, int y)
int index;
 
wwin = icon->icon->owner;
+   icon->editing = 0;
+
if (icon->command == NULL) {
char *command;
 
-   icon->editing = 0;
-
command = GetCommandForWindow(wwin->client_win);
if (command) {
icon->command = command;
@@ -1893,8 +1893,6 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, 
int y)
}
}
}
-   } else {
-   icon->editing = 0;
}
 
for (index = 1; index < dock->max_icons; index++)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/4] get_default_icon_filename rewrited

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_default_icon_filename(), now get_icon_filename(),
was working in a bad way. Before this patch, the function always
searched the default icon in the second search:

- file_name = wDefaultGetIconFile(winstance, wclass, True);
+ file_name = wDefaultGetIconFile(winstance, wclass, False);

For this reason, the argument default_icon didn't work.

This patch change it. Now, if the default_icon is false, the function
can return NULL, then other functions can do the correct work. For
example, now wDefaultGetImage() doesn't need do nothing, because the
default_icon is set to True. get_icon_filename() checks if the
icon exists in the disk before returning it (except for default icon
in get_default_image_path(scr).
---
 src/defaults.h  |4 ++--
 src/dialog.c|2 +-
 src/icon.c  |4 ++--
 src/wdefaults.c |   33 +
 4 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/src/defaults.h b/src/defaults.h
index 4104f84..e834c5a 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -50,7 +50,7 @@ RImage * wDefaultGetImage(WScreen *scr, char *winstance, char 
*wclass, int max_s
 int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
 void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
 RImage *get_default_image(WScreen *scr);
-char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, 
char *command,
-   Bool default_icon);
+char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char 
*command,
+   Bool default_icon);
 RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
 #endif /* WMDEFAULTS_H_ */
diff --git a/src/dialog.c b/src/dialog.c
index 5ec3ec6..6964495 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -1467,7 +1467,7 @@ static WMPixmap *getWindowMakerIconImage(WMScreen *scr)
char *path = NULL;
 
/* Get the Logo icon, without the default icon */
-   path = get_default_icon_filename(NULL, "Logo", "WMPanel", NULL, False);
+   path = get_icon_filename(NULL, "Logo", "WMPanel", NULL, False);
 
if (path) {
RColor gray;
diff --git a/src/icon.c b/src/icon.c
index f82be53..c987565 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -144,7 +144,7 @@ WIcon *icon_create_for_wwindow(WWindow *wwin)
wGetIconName(dpy, wwin->client_win, &icon->icon_name);
 
/* Get the application icon, default included */
-   file = get_default_icon_filename(scr, wwin->wm_instance, 
wwin->wm_class, NULL, True);
+   file = get_icon_filename(scr, wwin->wm_instance, wwin->wm_class, NULL, 
True);
if (file) {
icon->file = wstrdup(file);
icon->file_image = get_rimage_from_file(scr, icon->file, 
wPreferences.icon_size);
@@ -169,7 +169,7 @@ WIcon *icon_create_for_dock(WScreen *scr, char *command, 
char *wm_instance, char
icon = icon_create_core(scr, 0, 0);
 
/* Search the icon using instance and class, without default icon */
-   file = get_default_icon_filename(scr, wm_instance, wm_class, command, 
False);
+   file = get_icon_filename(scr, wm_instance, wm_class, command, False);
if (file) {
icon->file = wstrdup(file);
icon->file_image = get_rimage_from_file(scr, icon->file, 
wPreferences.icon_size);
diff --git a/src/wdefaults.c b/src/wdefaults.c
index 532b19e..a342369 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -376,8 +376,8 @@ static WMPropList *get_generic_value(char *instance, char 
*class,
 }
 
 /* Get the file name of the image, using instance and class */
-char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, 
char *command,
-   Bool default_icon)
+char *get_icon_filename(WScreen *scr, char *winstance, char *wclass, char 
*command,
+   Bool default_icon)
 {
char *file_name = NULL;
char *file_path = NULL;
@@ -389,13 +389,11 @@ char *get_default_icon_filename(WScreen *scr, char 
*winstance, char *wclass, cha
if (file_name)
file_path = FindImage(wPreferences.icon_path, file_name);
 
-   /* If the specific (or generic if default_icon is True) icon filename
-* is not found, and command is specified, then include the .app icons
-* and re-do the search, but now always including the default icon
-* so the icon is found always. The .app is selected before default */
+   /* If the specific icon filename is not found, and command is specified,
+* then include the .app icons and re-do the search. */
if ((!file_name || !file_path ) && scr && command) {
wApplicationExtractDirPackIcon(scr, command, winstance, wclass);
-  

[PATCH 4/4] get_default_image_path unused argument

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_default_image_path has the WScreen argument that
is not used, so can be removed.

The function could be static, but perhaps is interesting leave it
as public.
---
 src/defaults.h  |2 +-
 src/wdefaults.c |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/defaults.h b/src/defaults.h
index 197b9ab..a2b9f24 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -41,7 +41,7 @@ void wDefaultFillAttributes(char *instance, char *class,
 WWindowAttributes *attr, WWindowAttributes *mask,
 Bool useGlobalDefault);
 
-char *get_default_image_path(WScreen *scr);
+char *get_default_image_path(void);
 RImage *get_default_image(WScreen *scr);
 
 char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon);
diff --git a/src/wdefaults.c b/src/wdefaults.c
index 485..ae88a1d 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -413,7 +413,7 @@ char *get_icon_filename(WScreen *scr, char *winstance, char 
*wclass, char *comma
}
 
if (!file_path && default_icon)
-   file_path = get_default_image_path(scr);
+   file_path = get_default_image_path();   
 
return file_path;
 }
@@ -438,7 +438,7 @@ RImage *get_rimage_from_file(WScreen *scr, char *file_name, 
int max_size)
 
 /* This function returns the default icon's full path
  * If the path for an icon is not found, returns NULL */
-char *get_default_image_path(WScreen *scr)
+char *get_default_image_path(void)
 {
char *path = NULL, *file = NULL;
 
@@ -457,7 +457,7 @@ RImage *get_default_image(WScreen *scr)
char *path = NULL;
 
/* Get the filename full path */
-   path = get_default_image_path(scr);
+   path = get_default_image_path();
if (!path)
return NULL;
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/2] tileObserver doesn't create icon

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function tileObserver() is now faster, because don't
re-create the icon. Now only draw the icon pixmap.
---
 src/icon.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index c987565..8d9b52a 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -90,12 +90,15 @@ static void appearanceObserver(void *self, WMNotification 
*notif)
XClearArea(dpy, icon->core->window, 0, 0, icon->core->width, 
icon->core->height, True);
 }
 
-static void tileObserver(void *self, WMNotification * notif)
+static void tileObserver(void *self, WMNotification *notif)
 {
WIcon *icon = (WIcon *) self;
 
-   icon->force_paint = 1;
-   wIconPaint(icon);
+   /* If the rimage exists, update the icon, else create it */
+   if (icon->file_image)
+   update_icon_pixmap(icon);
+   else
+   wIconPaint(icon);
 
XClearArea(dpy, icon->core->window, 0, 0, 1, 1, True);
 }
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 0/2] Don't create icon

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

These two patches do the same idea. Check if the icon exists first. If the
icon exists (probably exist always), then only update the pixmap and don't
search the icon images again.

To avoid crashes, I added an "else" block to create the icon if don't exist.

Now the functions tileObserver() and wIconChangeTitle() are faster, because
don't create the icon.

Best Regards,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/2] wIconChangeTitle doesn't create icon

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wIconChangeTitle() is now faster, because don't
re-create the icon. Now only draw the icon pixmap.
---
 src/icon.c |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 8d9b52a..7903290 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -337,21 +337,25 @@ static void icon_update_pixmap(WIcon *icon, RImage *image)
icon->pixmap = pixmap;
 }
 
-void wIconChangeTitle(WIcon * icon, char *new_title)
+void wIconChangeTitle(WIcon *icon, char *new_title)
 {
int changed;
 
-   changed = (new_title == NULL && icon->icon_name != NULL)
-   || (new_title != NULL && icon->icon_name == NULL);
+   changed = (new_title == NULL && icon->icon_name != NULL) ||
+ (new_title != NULL && icon->icon_name == NULL);
 
if (icon->icon_name != NULL)
XFree(icon->icon_name);
 
icon->icon_name = new_title;
 
-   if (changed)
-   icon->force_paint = 1;
-   wIconPaint(icon);
+   if (changed) {
+   /* If the rimage exists, update the icon, else create it */
+   if (icon->file_image)
+   update_icon_pixmap(icon);
+   else
+   wIconPaint(icon);
+   }
 }
 
 RImage *wIconValidateIconSize(RImage *icon, int max_size)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 0/5] Remove force_paint flag

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

These patches removes the force_paint flag. A little explanation:

The function wIconPaint was something like this:

void wIconPaint(WIcon *icon)
{
WScreen *scr = icon->core->screen_ptr;
int x;
char *tmp;
 
if (icon->force_paint) {
icon->force_paint = 0;
wIconUpdate(icon);
return;
}
...

Then, in other parts of the code, was possible to do "icon->force_paint = 1",
then, when wIconPaint was called, the flow was (force_paint value):

wIconPaint(1) -> wIconUpdate(0) -> wIconPaint(0)

IMO is better if the icon needs to be (re)created, call it and then update it:

wIconUpdate;
wIconPaint;

But this is not always possible, for example with AppIcons, because we are
creating the icon, but is not created yet,...

These patches moves, step by step, the force_paint flag as argument between
functions, then remove it.

First, pass as argument (patches 1 and 2). Example:

-   wapp->app_icon->icon->force_paint = 1;
-   wAppIconPaint(wapp->app_icon);
+   wAppIconPaint(wapp->app_icon, True);


The patch 3 removes the force flag, because the info is in the functions, as
argument.

The patch 4 changes the "True" (force create icon) to "False", and create the
icon in that place:

-   wAppIconPaint(wapp->app_icon, True);
+
+   /* Update the icon images */
+   wIconUpdate(wapp->app_icon->icon);
+
+   /* Paint it */
+   wAppIconPaint(wapp->app_icon, False);

Patch 5, undo the patch 2, removing the wAppIconPaint argument because is always
False. I cannot remove the argument to patch 1 and wDockAttachIcon() must give
if need the icon udpated or not (but IMO is better, because the function know
if the icon is shadowed,... and the icon must or not be updated).

Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/5] wDockAttachIcon paint argument

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wDockAttachIcon has a new argument. This argument is used
to force an icon create if needed.
---
 src/appicon.c |7 ---
 src/dock.c|   13 +++--
 src/dock.h|2 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index 77c5e30..8a6841d 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -194,6 +194,7 @@ void paint_app_icon(WApplication *wapp)
WScreen *scr = wapp->main_window_desc->screen_ptr;
WDock *clip = scr->workspaces[scr->current_workspace]->clip;
int x = 0, y = 0;
+   Bool update_icon = False;
 
if (!wapp || !wapp->app_icon)
return;
@@ -209,9 +210,9 @@ void paint_app_icon(WApplication *wapp)
wapp->app_icon->attracted = 1;
if (!icon->shadowed) {
icon->shadowed = 1;
-   icon->force_paint = 1;
+   update_icon = True;
}
-   wDockAttachIcon(clip, wapp->app_icon, x, y);
+   wDockAttachIcon(clip, wapp->app_icon, x, y, update_icon);
} else {
/* We must know if the icon is painted in the screen,
 * because if painted, then PlaceIcon will return the next
@@ -849,7 +850,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
/* icon is trying to be docked */
SlideWindow(icon->core->window, x, y, shad_x, 
shad_y);
XUnmapWindow(dpy, scr->dock_shadow);
-   docked = wDockAttachIcon(scr->last_dock, aicon, 
ix, iy);
+   docked = wDockAttachIcon(scr->last_dock, aicon, 
ix, iy, False);
if (scr->last_dock->auto_collapse)
collapsed = 0;
 
diff --git a/src/dock.c b/src/dock.c
index 58ef31a..e6a575b 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -577,6 +577,7 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry 
*entry)
WDock *clip;
WAppIcon *aicon;
int x, y, x_pos, y_pos;
+   Bool update_icon = False;
 
assert(entry->clientdata != NULL);
clip = clickedIcon->dock;
@@ -593,12 +594,9 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry 
*entry)
aicon->attracted = 1;
if (!aicon->icon->shadowed) {
aicon->icon->shadowed = 1;
-   aicon->icon->force_paint = 1;
-   /* We don't do an wAppIconPaint() here because 
it's in
-* wDockAttachIcon(). -Dan
-*/
+   update_icon = True;
}
-   wDockAttachIcon(clip, aicon, x, y);
+   wDockAttachIcon(clip, aicon, x, y, update_icon);
if (clip->collapsed || !clip->mapped)
XUnmapWindow(dpy, aicon->icon->core->window);
}
@@ -1848,7 +1846,7 @@ int wDockReceiveDNDDrop(WScreen *scr, XEvent *event)
 }
 #endif /* XDND */
 
-Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
+Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool 
update_icon)
 {
WWindow *wwin;
int index;
@@ -1856,6 +1854,9 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, 
int y)
wwin = icon->icon->owner;
icon->editing = 0;
 
+   if (update_icon)
+   icon->icon->force_paint = 1;
+
if (icon->command == NULL) {
char *command;
 
diff --git a/src/dock.h b/src/dock.h
index be10095..08ae8de 100644
--- a/src/dock.h
+++ b/src/dock.h
@@ -79,7 +79,7 @@ void wDockRaise(WDock *dock);
 void wDockRaiseLower(WDock *dock);
 void wDockSaveState(WScreen *scr, WMPropList *old_state);
 
-Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y);
+Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool 
update_icon);
 Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
int *ret_x, int *ret_y, int redocking);
 Bool wDockFindFreeSlot(WDock *dock, int *req_x, int *req_y);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/5] wAppIconPaint paint argument

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function wAppIconPaint has a new argument. This argument is used
to force an icon create if needed.
---
 src/actions.c |   12 ++--
 src/appicon.c |   27 +++
 src/appicon.h |2 +-
 src/application.c |4 ++--
 src/client.c  |4 +++-
 src/defaults.c|9 +
 src/dock.c|   26 ++
 src/dockedapp.c   |8 +---
 src/winspector.c  |8 ++--
 src/wmspec.c  |3 ++-
 src/workspace.c   |2 +-
 11 files changed, 60 insertions(+), 45 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index 13ed426..e168c56 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1540,12 +1540,12 @@ void wHideApplication(WApplication *wapp)
 
wapp->flags.hidden = 1;
 
-   if (wPreferences.auto_arrange_icons) {
+   if (wPreferences.auto_arrange_icons)
wArrangeIcons(scr, True);
-   }
+
 #ifdef HIDDENDOT
if (wapp->app_icon)
-   wAppIconPaint(wapp->app_icon);
+   wAppIconPaint(wapp->app_icon, False);
 #endif
 }
 
@@ -1669,11 +1669,11 @@ void wUnhideApplication(WApplication *wapp, Bool 
miniwindows, Bool bringToCurren
wSetFocusTo(scr, focused);
}
wapp->last_focused = NULL;
-   if (wPreferences.auto_arrange_icons) {
+   if (wPreferences.auto_arrange_icons)
wArrangeIcons(scr, True);
-   }
+
 #ifdef HIDDENDOT
-   wAppIconPaint(wapp->app_icon);
+   wAppIconPaint(wapp->app_icon, False);
 #endif
 }
 
diff --git a/src/appicon.c b/src/appicon.c
index 8a6841d..4426e7c 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -238,7 +238,7 @@ void paint_app_icon(WApplication *wapp)
wArrangeIcons(scr, True);
 }
 
-void removeAppIconFor(WApplication * wapp)
+void removeAppIconFor(WApplication *wapp)
 {
if (!wapp->app_icon)
return;
@@ -252,8 +252,7 @@ void removeAppIconFor(WApplication * wapp)
wapp->app_icon->pid = 0;
wapp->app_icon->icon->owner = NULL;
wapp->app_icon->icon->icon_win = None;
-   wapp->app_icon->icon->force_paint = 1;
-   wAppIconPaint(wapp->app_icon);
+   wAppIconPaint(wapp->app_icon, True);
} else if (wapp->app_icon->docked) {
wapp->app_icon->running = 0;
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
@@ -371,7 +370,7 @@ static void updateDockNumbers(WScreen * scr)
 }
 #endif /* WS_INDICATOR */
 
-void wAppIconPaint(WAppIcon * aicon)
+void wAppIconPaint(WAppIcon *aicon, Bool update_icon)
 {
WApplication *wapp;
WScreen *scr = aicon->icon->core->screen_ptr;
@@ -381,6 +380,9 @@ void wAppIconPaint(WAppIcon * aicon)
else
wapp = NULL;
 
+   if (update_icon)
+   aicon->icon->force_paint = 1;
+
wIconPaint(aicon->icon);
 
 # ifdef WS_INDICATOR
@@ -484,7 +486,7 @@ static void unhideHereCallback(WMenu * menu, WMenuEntry * 
entry)
wUnhideApplication(wapp, False, True);
 }
 
-static void setIconCallback(WMenu * menu, WMenuEntry * entry)
+static void setIconCallback(WMenu *menu, WMenuEntry *entry)
 {
WAppIcon *icon = ((WApplication *) entry->clientdata)->app_icon;
char *file = NULL;
@@ -513,7 +515,9 @@ static void setIconCallback(WMenu * menu, WMenuEntry * 
entry)
   _("Could not open specified icon file"), 
_("OK"), NULL, NULL);
} else {
wDefaultChangeIcon(scr, icon->wm_instance, 
icon->wm_class, file);
-   wAppIconPaint(icon);
+   /* The image was updated previously at 
wIconChangeImageFile,
+* so we don't need update it here again */
+   wAppIconPaint(icon, False);
}
if (file)
wfree(file);
@@ -568,7 +572,7 @@ static void killCallback(WMenu * menu, WMenuEntry * entry)
WCHANGE_STATE(WSTATE_NORMAL);
 }
 
-static WMenu *createApplicationMenu(WScreen * scr)
+static WMenu *createApplicationMenu(WScreen *scr)
 {
WMenu *menu;
 
@@ -619,12 +623,12 @@ static void openApplicationMenu(WApplication * wapp, int 
x, int y)
 
 /**/
 
-static void iconExpose(WObjDescriptor * desc, XEvent * event)
+static void iconExpose(WObjDescriptor *desc, XEvent *event)
 {
-   wAppIconPaint(desc->parent);
+   wAppIconPaint(desc->parent, False);
 }
 
-static void iconDblClick(WObjDescriptor * desc, XEvent * event)
+static void iconDblClick(WObjDescriptor *desc, XEvent *event)
 {
WAppIcon *aicon = desc->parent;
WApplication *wapp;
@

[PATCH 3/5] force_paint removed

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

The WIcon variable force_paint can be removed, because now is possible
update the icon directly in the function wAppIconPaint.

Now wAppIconPaint creates the RImage file if needed, and then paint it.
---
 src/appicon.c |2 +-
 src/icon.c|   29 ++---
 src/icon.h|1 -
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index 4426e7c..133aabc 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -381,7 +381,7 @@ void wAppIconPaint(WAppIcon *aicon, Bool update_icon)
wapp = NULL;
 
if (update_icon)
-   aicon->icon->force_paint = 1;
+   wIconUpdate(aicon->icon);
 
wIconPaint(aicon->icon);
 
diff --git a/src/icon.c b/src/icon.c
index c987565..ba059ad 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -90,12 +90,11 @@ static void appearanceObserver(void *self, WMNotification 
*notif)
XClearArea(dpy, icon->core->window, 0, 0, icon->core->width, 
icon->core->height, True);
 }
 
-static void tileObserver(void *self, WMNotification * notif)
+static void tileObserver(void *self, WMNotification *notif)
 {
WIcon *icon = (WIcon *) self;
 
-   icon->force_paint = 1;
-   wIconPaint(icon);
+   wIconUpdate(icon);
 
XClearArea(dpy, icon->core->window, 0, 0, 1, 1, True);
 }
@@ -334,12 +333,12 @@ static void icon_update_pixmap(WIcon *icon, RImage *image)
icon->pixmap = pixmap;
 }
 
-void wIconChangeTitle(WIcon * icon, char *new_title)
+void wIconChangeTitle(WIcon *icon, char *new_title)
 {
int changed;
 
-   changed = (new_title == NULL && icon->icon_name != NULL)
-   || (new_title != NULL && icon->icon_name == NULL);
+   changed = (new_title == NULL && icon->icon_name != NULL) ||
+ (new_title != NULL && icon->icon_name == NULL);
 
if (icon->icon_name != NULL)
XFree(icon->icon_name);
@@ -347,8 +346,9 @@ void wIconChangeTitle(WIcon * icon, char *new_title)
icon->icon_name = new_title;
 
if (changed)
-   icon->force_paint = 1;
-   wIconPaint(icon);
+   wIconUpdate(icon);
+   else
+   wIconPaint(icon);
 }
 
 RImage *wIconValidateIconSize(RImage *icon, int max_size)
@@ -762,25 +762,16 @@ static int get_rimage_icon_from_wm_hints(WIcon *icon)
return 0;
 }
 
-void wIconPaint(WIcon * icon)
+void wIconPaint(WIcon *icon)
 {
WScreen *scr = icon->core->screen_ptr;
-   int x;
+   int x, l, w;
char *tmp;
 
-   if (icon->force_paint) {
-   icon->force_paint = 0;
-   wIconUpdate(icon);
-   return;
-   }
-
XClearWindow(dpy, icon->core->window);
 
/* draw the icon title */
if (icon->show_title && icon->icon_name != NULL) {
-   int l;
-   int w;
-
tmp = ShrinkString(scr->icon_title_font, icon->icon_name, 
wPreferences.icon_size - 4);
w = WMWidthOfString(scr->icon_title_font, tmp, l = strlen(tmp));
 
diff --git a/src/icon.h b/src/icon.h
index 48cf58b..dfa30bc 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -41,7 +41,6 @@ typedef struct WIcon {
 
unsigned inttile_type:4;
unsigned intshow_title:1;
-   unsigned intforce_paint:1;  /* True for icon update and repaint */
unsigned intselected:1;
unsigned intstep:3; /* selection cycle step */
unsigned intshadowed:1; /* If the icon is to be blured */
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 4/5] Update icon images before call wIconUpdate

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch updates the icon images if needed before call wIconUpdate.
---
 src/appicon.c |   13 +++--
 src/dock.c|   34 ++
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index 133aabc..8e8c22b 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -252,7 +252,12 @@ void removeAppIconFor(WApplication *wapp)
wapp->app_icon->pid = 0;
wapp->app_icon->icon->owner = NULL;
wapp->app_icon->icon->icon_win = None;
-   wAppIconPaint(wapp->app_icon, True);
+
+   /* Update the icon images */
+   wIconUpdate(wapp->app_icon->icon);
+
+   /* Paint it */
+   wAppIconPaint(wapp->app_icon, False);
} else if (wapp->app_icon->docked) {
wapp->app_icon->running = 0;
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
@@ -988,7 +993,11 @@ void create_appicon_from_dock(WWindow *wwin, WApplication 
*wapp, Window main_win
if (mainw->wm_hints && (mainw->wm_hints->flags & 
IconWindowHint))
wapp->app_icon->icon->icon_win = 
mainw->wm_hints->icon_window;
 
-   wAppIconPaint(wapp->app_icon, True);
+   /* Update the icon images */
+   wIconUpdate(wapp->app_icon->icon);
+
+   /* Paint it */
+   wAppIconPaint(wapp->app_icon, False);
save_appicon(wapp->app_icon, True);
}
 }
diff --git a/src/dock.c b/src/dock.c
index 295f717..6c34377 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -534,11 +534,17 @@ static void keepIconsCallback(WMenu *menu, WMenuEntry 
*entry)
WM_ITERATE_ARRAY(selectedIcons, aicon, it) {
if (aicon->icon->selected)
wIconSelect(aicon->icon);
+
if (aicon && aicon->attracted && aicon->command) {
aicon->attracted = 0;
if (aicon->icon->shadowed) {
aicon->icon->shadowed = 0;
-   wAppIconPaint(aicon, True);
+
+   /* Update the icon images */
+   wIconUpdate(aicon->icon);
+
+   /* Paint it */
+   wAppIconPaint(aicon, False);
}
}
save_appicon(aicon, True);
@@ -1929,7 +1935,15 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, 
int y, Bool update_icon
 
MoveInStackListUnder(dock->icon_array[index - 1]->icon->core, 
icon->icon->core);
wAppIconMove(icon, icon->x_pos, icon->y_pos);
-   wAppIconPaint(icon, lupdate_icon);
+
+   /* Update the icon images */
+   if (lupdate_icon)
+   wIconUpdate(icon->icon);
+
+   /* Paint it */
+   wAppIconPaint(icon, False);
+
+   /* Save it */
save_appicon(icon, True);
 
if (wPreferences.auto_arrange_icons)
@@ -2072,7 +2086,13 @@ static Bool moveIconBetweenDocks(WDock *src, WDock 
*dest, WAppIcon *icon, int x,
dest->icon_count++;
 
MoveInStackListUnder(dest->icon_array[index - 1]->icon->core, 
icon->icon->core);
-   wAppIconPaint(icon, update_icon);
+
+   /* Update the icon images */
+   if (update_icon)
+   wIconUpdate(icon->icon);
+
+   /* Paint it */
+   wAppIconPaint(icon, False);
 
return True;
 }
@@ -2144,7 +2164,13 @@ void wDockDetach(WDock *dock, WAppIcon *icon)
 
ChangeStackingLevel(icon->icon->core, NORMAL_ICON_LEVEL);
 
-   wAppIconPaint(icon, update_icon);
+   /* Update the icon images */
+   if (update_icon)
+   wIconUpdate(icon->icon);
+
+   /* Paint it */
+   wAppIconPaint(icon, False);
+
if (wPreferences.auto_arrange_icons)
wArrangeIcons(dock->screen_ptr, True);
}
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 5/5] wAppIconPaint argument removed

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch removes the wAppIconPaint() Bool flag, because now is
always False.
---
 src/actions.c |4 ++--
 src/appicon.c |   15 +--
 src/appicon.h |2 +-
 src/application.c |4 ++--
 src/client.c  |4 +---
 src/defaults.c|4 +---
 src/dock.c|   14 +++---
 src/dockedapp.c   |4 +---
 src/winspector.c  |4 +---
 src/wmspec.c  |3 +--
 src/workspace.c   |2 +-
 11 files changed, 23 insertions(+), 37 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index e168c56..7dceaff 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1545,7 +1545,7 @@ void wHideApplication(WApplication *wapp)
 
 #ifdef HIDDENDOT
if (wapp->app_icon)
-   wAppIconPaint(wapp->app_icon, False);
+   wAppIconPaint(wapp->app_icon);
 #endif
 }
 
@@ -1673,7 +1673,7 @@ void wUnhideApplication(WApplication *wapp, Bool 
miniwindows, Bool bringToCurren
wArrangeIcons(scr, True);
 
 #ifdef HIDDENDOT
-   wAppIconPaint(wapp->app_icon, False);
+   wAppIconPaint(wapp->app_icon);
 #endif
 }
 
diff --git a/src/appicon.c b/src/appicon.c
index 8e8c22b..329bd6e 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -257,7 +257,7 @@ void removeAppIconFor(WApplication *wapp)
wIconUpdate(wapp->app_icon->icon);
 
/* Paint it */
-   wAppIconPaint(wapp->app_icon, False);
+   wAppIconPaint(wapp->app_icon);
} else if (wapp->app_icon->docked) {
wapp->app_icon->running = 0;
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
@@ -375,7 +375,7 @@ static void updateDockNumbers(WScreen * scr)
 }
 #endif /* WS_INDICATOR */
 
-void wAppIconPaint(WAppIcon *aicon, Bool update_icon)
+void wAppIconPaint(WAppIcon *aicon)
 {
WApplication *wapp;
WScreen *scr = aicon->icon->core->screen_ptr;
@@ -385,9 +385,6 @@ void wAppIconPaint(WAppIcon *aicon, Bool update_icon)
else
wapp = NULL;
 
-   if (update_icon)
-   wIconUpdate(aicon->icon);
-
wIconPaint(aicon->icon);
 
 # ifdef WS_INDICATOR
@@ -520,9 +517,7 @@ static void setIconCallback(WMenu *menu, WMenuEntry *entry)
   _("Could not open specified icon file"), 
_("OK"), NULL, NULL);
} else {
wDefaultChangeIcon(scr, icon->wm_instance, 
icon->wm_class, file);
-   /* The image was updated previously at 
wIconChangeImageFile,
-* so we don't need update it here again */
-   wAppIconPaint(icon, False);
+   wAppIconPaint(icon);
}
if (file)
wfree(file);
@@ -630,7 +625,7 @@ static void openApplicationMenu(WApplication * wapp, int x, 
int y)
 
 static void iconExpose(WObjDescriptor *desc, XEvent *event)
 {
-   wAppIconPaint(desc->parent, False);
+   wAppIconPaint(desc->parent);
 }
 
 static void iconDblClick(WObjDescriptor *desc, XEvent *event)
@@ -997,7 +992,7 @@ void create_appicon_from_dock(WWindow *wwin, WApplication 
*wapp, Window main_win
wIconUpdate(wapp->app_icon->icon);
 
/* Paint it */
-   wAppIconPaint(wapp->app_icon, False);
+   wAppIconPaint(wapp->app_icon);
save_appicon(wapp->app_icon, True);
}
 }
diff --git a/src/appicon.h b/src/appicon.h
index f6eabd6..6f72c8e 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -74,7 +74,7 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, 
char *wm_instance,
 
 void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window 
main_window);
 void wAppIconDestroy(WAppIcon *aicon);
-void wAppIconPaint(WAppIcon *aicon, Bool update_icon);
+void wAppIconPaint(WAppIcon *aicon);
 void wAppIconMove(WAppIcon *aicon, int x, int y);
 void makeAppIconFor(WApplication * wapp);
 void removeAppIconFor(WApplication * wapp);
diff --git a/src/application.c b/src/application.c
index 274cff6..7c52fa0 100644
--- a/src/application.c
+++ b/src/application.c
@@ -215,7 +215,7 @@ void wApplicationActivate(WApplication *wapp)
 #ifdef NEWAPPICON
if (wapp->app_icon) {
wIconSetHighlited(wapp->app_icon->icon, True);
-   wAppIconPaint(wapp->app_icon, False);
+   wAppIconPaint(wapp->app_icon);
}
 #endif
 }
@@ -225,7 +225,7 @@ void wApplicationDeactivate(WApplication *wapp)
 #ifdef NEWAPPICON
if (wapp->app_icon) {
wIconSetHighlited(wapp->app_icon->icon, False);
-   wAppIconPaint(wapp->app_icon, False);
+   wAppIconPaint(wapp->app_icon);
}
 #endif
 }
diff --git a/src/client.c b/src/client.

[PATCH] Window comments cleanup

2012-11-10 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch only add some tabs the window.h (only window struct area).

The main change is that moves this block to switchpanel.c, because
is only used there:

   ((w)->wm_gnustep_attr->flags & GSWindowLevelAttr) && \
   ((w)->wm_gnustep_attr->window_level == WMMainMenuWindowLevel || \
(w)->wm_gnustep_attr->window_level == WMSubmenuWindowLevel))

The patch also include two comments in the window's image:

- WIcon icon is only used when the window is minimized, else is NULL
- RImage has the window image, used in switchpanel,...
---
 src/switchmenu.c |5 ++
 src/window.h |  252 ++
 2 files changed, 125 insertions(+), 132 deletions(-)

diff --git a/src/switchmenu.c b/src/switchmenu.c
index 5a3f961..6569252 100644
--- a/src/switchmenu.c
+++ b/src/switchmenu.c
@@ -38,6 +38,11 @@
 #include "workspace.h"
 #include "framewin.h"
 
+#define IS_GNUSTEP_MENU(w) ((w)->wm_gnustep_attr && \
+   ((w)->wm_gnustep_attr->flags & GSWindowLevelAttr) && \
+   ((w)->wm_gnustep_attr->window_level == WMMainMenuWindowLevel || \
+(w)->wm_gnustep_attr->window_level == WMSubmenuWindowLevel))
+
 /* Global Variables ***/
 extern WPreferences wPreferences;
 
diff --git a/src/window.h b/src/window.h
index cdb5bc7..c4148a3 100644
--- a/src/window.h
+++ b/src/window.h
@@ -175,146 +175,134 @@ typedef struct WFakeGroupLeader {
  * structure created when it's being first mapped.
  */
 typedef struct WWindow {
-struct WWindow *prev; /* window focus list */
-struct WWindow *next;
-
-WScreen *screen_ptr;  /* pointer to the screen structure */
-WWindowAttributes user_flags;  /* window attribute flags set by user */
-WWindowAttributes defined_user_flags;/* mask for user_flags */
-WWindowAttributes client_flags;/* window attribute flags set by app
-* initialized with global defaults */
-
-struct InspectorPanel *inspector;  /*  pointer to attribute editor panel */
-
-struct WFrameWindow *frame;   /* the frame window */
-int frame_x, frame_y; /* position of the frame in root*/
-
-struct {
-int x, y;
-unsigned int width, height;/* original geometry of the window */
-} old_geometry;   /* (before things like maximize) */
-
-struct {
-int x, y;
-unsigned int width, height;/* original geometry of the window */
-} bfs_geometry;   /* (before fullscreen) */
-
-int maximus_x;/* size after Maximusizing */
-int maximus_y;
-
-/* client window info */
-short old_border_width;   /* original border width of client_win*/
-Window client_win;/* the window we're managing */
-WObjDescriptor client_descriptor;  /* dummy descriptor for client */
-struct {
-int x, y; /* position of *client* relative
-* to root */
-unsigned int width, height;/* size of the client window */
-} client;
-
-XSizeHints *normal_hints; /* WM_NORMAL_HINTS */
-XWMHints *wm_hints;   /* WM_HINTS (optional) */
-char *wm_instance;/* instance of WM_CLASS */
-char *wm_class;   /* class of WM_CLASS */
-GNUstepWMAttributes *wm_gnustep_attr;/* GNUstep window attributes */
-
-int state;/* state as in ICCCM */
-
-Window transient_for; /* WM_TRANSIENT_FOR */
-
-WFakeGroupLeader *fake_group;  /* Fake group leader for grouping into
-  a single appicon */
-Window group_id;  /* the leader window of the group */
-Window client_leader; /* WM_CLIENT_LEADER if not
-  internal_window */
-
-Window main_window;   /* main window for the 
application */
-
-Window orig_main_window;  /* original main window of 
application.
-  used for the shared appicon thing */
-
-int cmap_window_no;
-Window *cmap_windows;
-
-/* protocols */
-WProtocols protocols; /* accepted WM_PROTOCOLS */
-
-FocusMode focus_mode; /* type of keyboard input focus */
-
-long event_mask;  /* the event mask thats selected */
-
-struct {
-/* state flags */
-unsigned int mapped:1;
-unsigned int focused:1;
-unsigned int miniaturized:1;
-unsigned int hidden:1;
-unsigned int shaded:1;
-   unsigned int maximized:5;
-   unsigned int old_maximized:5;
-unsigned int full

Focus problem

2012-11-12 Thread kix

Hi,

I have a problem with the focus in vmplayer (vmware player). I have 
this problem with other apps, but I don't remember them. I think the 
problem is related to some gtk applications.


When I run vmplayer (you can download it, is free) all the dialog boxes 
are under the main window, and sometimes I cannot see them.


Please, comments are welcome. I will add this bug to the Mantis BTS 
with the comments.


OTOH, probably this problem is realated to other problem reported, 
about no miniwindows for dialog boxes.


Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Call for testing before 0.95.4

2012-11-13 Thread kix

On 2012-11-12 23:00, BALATON Zoltan wrote:

On Mon, 12 Nov 2012, Carlos R. Mafra wrote:

Please do test the #next branch and report any problems (if any).
There has been a lot of code churn related to icons. Even though 
they

look relative safe, regressions might be hiding somewhere.


I'm not sure if the "Ignore client supplied icon" option in the Icon
and Initial Workspace inspector is still working. At least Xfig now
has the icon I set in the app icon but displays its own icon in the
miniwindow (which is obscuring the tile completely).


Hi again,

there are two problems:

1. xfig don't have the WM_ICON_NAME set, therefore the function 
wIconPaint() don't draw the title. You can try to set the value with 
xprop, reload windowmaker and then the title will appear in xfig's icon. 
The update pixmap function don't paint the background square because the 
variable titled is created using the WM_ICON_NAME value too.


2. As I said in my final mail about icons (that was not my last mail 
about icons :-) ), the icon image and the window image are different. 
icon image is window->icon and window image is window->net_icon_image. 
If the user sets the icon, then the selected icon is used in the window 
(alt+tab) and in the icon, but if is not set, then the icons could be 
different.


Comments about these problems are very welcome. Again, if WM_ICON_NAME 
is not set, probably we could use something here.



Related to this, if the client supplied icon is too big (like for
gtk-demo for example) it is simply clipped and not resized. An
improvement though that it now seems to be centered at least. Could
the icon be resized (maybe before being cached) to improve this.


I sent a patch yesterday. The problem is that the wIconValidateIconSize 
didn't check the width and the height size for the icon, only checked 
one of them. The new patch check both values and holds the icon aspect 
ratio.


Best regards,
kix

(snip)

Regards,
BALATON Zoltan


--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] get_wwindow_image_from_wmhints scale image

2012-11-16 Thread kix

On 2012-11-15 03:32, BALATON Zoltan wrote:

On Wed, 14 Nov 2012, Rodolfo García Peñas wrote:
Then, the image can be resized using wIconValidateIconSize(). The 
resize
should be done in get_rimage_icon_from_wm_hints(), not in the 
function

get_wwindow_image_from_wmhints(). This is because the function
get_wwindow_image_from_wmhints() is used in wIconStore() too. If we 
resize
the image before save it to disk, then if we change the icon/dock 
size, then
the image saved will have a different size than the curren icon 
size. Is
better resize the image when is painted in the screen, not the image 
saved.


Thanks a lot for fixing all this. I couldn't really follow all your
changes so I'm not sure how it all works now so here are some
questions/thoughts. I think you've thought about these already but
asking it just in case:


Hi!,

I am busy these days :-( a lot of work. I will try to release the patch 
about winspector these weekend. Sorry for the delay.



- This does not mean that the image is resized every time it is
painted, does it? If yes then it may be faster to check the size of
the cached image before using it and remove it when the icon size has
been changed.


Yes and no. There are two steps in the image usage:

1. Read the file/X11/... and load the image in icon->file_image 
(wIconUpdate)
2. Paint the image. Read the icon->file_image and paint it in the 
screen as pixmap (update_pixmap() or something like).


Things:
- Now, the image at wIconUpdate (step 1) is only changed when is loaded 
first time and if the image changes.
- The image is painted and painted (step 2) multiple times in the 
wmaker session, for example selecting windows,..
- The image resize is done in the process at wIconUpdate, so is only 
resized when the image is loaded or changed, not when is painted.


Therefore, the image is resized (if needed) only one time when the 
application is running.


The image is not resized when it is saved as cache icon. Why? because 
if we change the icon size, then the caché image has a wrong size.



- Images are also enlarged when they are too small? This may look bad
so probably there could be a limit (say no more than 2x) or only 
scale

down images if they are too big but never enlarge them.


No. But could be easy to implement. Now, all image resize is done at 
wIconValidateIconSize(). This function is quick, because see the image 
width and height and resize it only if the image is bigger than the icon 
size.


If you want it, I can do it. I am not sure about the quality of the 
resize image, but I think wrlib includes some functions to do it fine.



- Is it possible to change icons of applications without restarting
them (the Apply button in the inspector is working) and does the
ignore client supplied icon option work?


Yes. I am working in the patch. I will try to release the patches this 
weekend.



Regards,
BALATON Zoltan


Thanks a lot for your comments/ideas.
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/6] create_stdcmap is never used

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

The create_stdcmap variable is never set, so can be removed.

This patch don't update the translation .po files!
---
 src/WindowMaker.h |1 -
 src/main.c|1 -
 src/screen.c  |8 ++--
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index ca89299..afc2871 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -439,7 +439,6 @@ typedef struct WPreferences {
 unsigned int noupdates:1;  /* don't require ~/GNUstep (-static) */
 unsigned int noautolaunch:1;   /* don't autolaunch apps */
 unsigned int norestore:1;  /* don't restore session */
-unsigned int create_stdcmap:1; /* create std colormap */
 #ifndef HAVE_INOTIFY
unsigned int nopolling:1;  /* don't poll the defaults database for 
changes */
 #endif
diff --git a/src/main.c b/src/main.c
index f492ac6..b09b6ef 100644
--- a/src/main.c
+++ b/src/main.c
@@ -498,7 +498,6 @@ static void print_help(void)
 
puts(_(" --locale localelocale to use"));
 
-   puts(_(" --create-stdcmap   create the standard colormap hint in 
PseudoColor visuals"));
puts(_(" --visual-id visualid   visual id of visual to use"));
puts(_(" --static   do not update or save configurations"));
 #ifndef HAVE_INOTIFY
diff --git a/src/screen.c b/src/screen.c
index 1ba325c..ecdb498 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -596,12 +596,8 @@ WScreen *wScreenInit(int screen_number)
if (rattr.colors_per_channel < 2)
rattr.colors_per_channel = 2;
 
-   /* will only be accounted for in PseudoColor */
-   if (wPreferences.flags.create_stdcmap) {
-   rattr.standard_colormap_mode = RCreateStdColormap;
-   } else {
-   rattr.standard_colormap_mode = RUseStdColormap;
-   }
+   /* Use standard colormap */
+   rattr.standard_colormap_mode = RUseStdColormap;
 
if (getWVisualID(screen_number) >= 0) {
rattr.flags |= RC_VisualID;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/6] window.c clean code 1

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch only make some code style clean.
---
 src/window.c |   80 +++---
 1 file changed, 32 insertions(+), 48 deletions(-)

diff --git a/src/window.c b/src/window.c
index 7f12c65..1cb384a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -596,6 +596,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* mutex. */
XGrabServer(dpy);
XSync(dpy, False);
+
/* make sure the window is still there */
if (!XGetWindowAttributes(dpy, window, &wattribs)) {
XUngrabServer(dpy);
@@ -621,7 +622,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
title = wNETWMGetWindowName(window);
if (title)
wwin->flags.net_has_title = 1;
-   if (!title && !wFetchName(dpy, window, &title))
+   else if (!wFetchName(dpy, window, &title))
title = NULL;
 
XSaveContext(dpy, window, wWinContext, (XPointer) & 
wwin->client_descriptor);
@@ -639,9 +640,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
}
 #endif
 
-   /*
-* Get hints and other information in properties
-*/
+   /* Get hints and other information in properties */
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
 
/* setup descriptor */
@@ -676,7 +675,6 @@ WWindow *wManageWindow(WScreen *scr, Window window)
 
if (wwin->wm_hints) {
if (wwin->wm_hints->flags & StateHint) {
-
if (wwin->wm_hints->initial_state == IconicState) {
wwin->flags.miniaturized = 1;
} else if (wwin->wm_hints->initial_state == 
WithdrawnState) {
@@ -784,7 +782,6 @@ WWindow *wManageWindow(WScreen *scr, Window window)
}
}
wwin->fake_group = fPtr;
-   /*wwin->group_id = fPtr->leader; */
wwin->main_window = fPtr->leader;
wfree(buffer);
} else {
@@ -802,11 +799,12 @@ WWindow *wManageWindow(WScreen *scr, Window window)
fPtr->origLeader = wwin->main_window;
}
wwin->fake_group = fPtr;
-   /*wwin->group_id = fPtr->leader; */
wwin->main_window = fPtr->leader;
}
+
if (instance)
free(instance);
+
if (class)
free(class);
 #undef ADEQUATE
@@ -825,11 +823,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
 
/* apply previous state if it exists and we're in startup */
if (scr->flags.startup && wm_state >= 0) {
-   if (wm_state == IconicState) {
+   if (wm_state == IconicState)
wwin->flags.miniaturized = 1;
-   } else if (wm_state == WithdrawnState) {
+   else if (wm_state == WithdrawnState)
withdraw = True;
-   }
}
 
/* if there is a saved state (from file), restore it */
@@ -909,6 +906,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
}
}
}
+
if (wstate != NULL)
wfree(wstate);
}
@@ -944,6 +942,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
width = win_state->state->w;
height = win_state->state->h;
}
+
wWindowConstrainSize(wwin, &width, &height);
 
/* do not ask for window placement if the window is
@@ -972,9 +971,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
y = transientOwner->frame_y +
abs((transientOwner->frame->core->height - 
height) / 3) + offs;
 
-   /*
-* limit transient windows to be inside their 
parent's head
-*/
+   /* limit transient windows to be inside their 
parent's head */
rect.pos.x = transientOwner->frame_x;
rect.pos.y = transientOwner->frame_y;
rect.size.width = 
transientOwner->frame->core->width;
@@ -997,28 +994,25 @@ WWindow *wManageWindow(WScreen *scr, Window window)
PlaceWindow(wwin, &x, &y, width, height);
frame_adjustment = False;
}
-   if (wPreferences.window_placement == WPM_MANUAL) {
+
+   

[PATCH 3/6] WWindow has always icon - Remove wIconDestroy

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch removes the wIconDestroy and the window always has icon.
This patch doesn't create the icon at the window creation! so yet
WWindow icon could be null.

This patch also adds this bug when the window is removed:

wmaker(RemoveFromStackList(stacking.c:567)): \
warning: RemoveFromStackingList(): window not in list

Because the stacking is not updated correctly.
---
 src/actions.c |6 +-
 src/wmspec.c  |   16 +---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index a79de8a..e1e6aaa 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1318,12 +1318,8 @@ void wDeiconifyWindow(WWindow *wwin)
}
 
if (!wPreferences.disable_miniwindows && wwin->icon != NULL
-   && !wwin->flags.net_handle_icon) {
+   && !wwin->flags.net_handle_icon)
RemoveFromStackList(wwin->icon->core);
-   /*removeIconGrabs(wwin->icon); */
-   wIconDestroy(wwin->icon);
-   wwin->icon = NULL;
-   }
 
if (!netwm_hidden) {
XUngrabServer(dpy);
diff --git a/src/wmspec.c b/src/wmspec.c
index c758f0a..f8e0029 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1053,18 +1053,6 @@ static void doStateAtom(WWindow *wwin, Atom state, int 
set, Bool init)
}
 }
 
-static void removeIcon(WWindow *wwin)
-{
-   if (wwin->icon == NULL)
-   return;
-   if (wwin->flags.miniaturized && wwin->icon->mapped) {
-   XUnmapWindow(dpy, wwin->icon->core->window);
-   RemoveFromStackList(wwin->icon->core);
-   wIconDestroy(wwin->icon);
-   wwin->icon = NULL;
-   }
-}
-
 static Bool handleWindowType(WWindow *wwin, Atom type, int *layer)
 {
Bool ret = True;
@@ -1282,9 +1270,7 @@ static Bool updateNetIconInfo(WWindow *wwin)
}
 
if (wwin->flags.miniaturized && old_state != 
wwin->flags.net_handle_icon) {
-   if (wwin->flags.net_handle_icon) {
-   removeIcon(wwin);
-   } else {
+   if (!wwin->flags.net_handle_icon) {
wwin->flags.miniaturized = False;
wwin->flags.skip_next_animation = True;
wIconifyWindow(wwin);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 4/6] WWindow always has icon - Add WIcon

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

Now WWindow always has window because is created when the window
is created.

We need set the X-Position for the window, because else is placed
at 0,0. Then we set it with XMoveWindow.
---
 src/actions.c |9 ++---
 src/window.c  |9 +
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index e1e6aaa..5f9d01e 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1082,7 +1082,7 @@ static WWindow *recursiveTransientFor(WWindow * wwin)
return wwin;
 }
 
-void wIconifyWindow(WWindow * wwin)
+void wIconifyWindow(WWindow *wwin)
 {
XWindowAttributes attribs;
int present;
@@ -1114,7 +1114,8 @@ void wIconifyWindow(WWindow * wwin)
if (!wwin->flags.icon_moved)
PlaceIcon(wwin->screen_ptr, &wwin->icon_x, 
&wwin->icon_y, wGetHeadForWindow(wwin));
 
-   wwin->icon = icon_create_for_wwindow(wwin);
+   /* Update the icon pixmap */
+   update_icon_pixmap(wwin->icon);
wwin->icon->mapped = 1;
}
 
@@ -1170,8 +1171,10 @@ void wIconifyWindow(WWindow * wwin)
 
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
if (wwin->screen_ptr->current_workspace == 
wwin->frame->workspace ||
-   IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
+   IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons) {
XMapWindow(dpy, wwin->icon->core->window);
+   XMoveWindow(dpy, wwin->icon->core->window, 
wwin->icon_x, wwin->icon_y);
+   }
 
AddToStackList(wwin->icon->core);
wLowerFrame(wwin->icon->core);
diff --git a/src/window.c b/src/window.c
index 1cb384a..ac36b1c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -819,6 +819,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (WFLAGP(wwin, start_maximized) && IS_RESIZABLE(wwin))
wwin->flags.maximized = MAX_VERTICAL | MAX_HORIZONTAL;
 
+   /* FIXME: Remove this line? */
wNETWMCheckInitialClientState(wwin);
 
/* apply previous state if it exists and we're in startup */
@@ -1357,6 +1358,14 @@ WWindow *wManageWindow(WScreen *scr, Window window)
wwin = NULL;
}
 
+   if (wwin) {
+   /* Create the icon for the window */
+   wwin->icon = icon_create_for_wwindow(wwin);
+
+   /* Create the window icon */
+   wwin->net_icon_image = 
get_window_image_from_x11(wwin->client_win);
+   }
+
return wwin;
 }
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 5/6] stacking.h removed white lines

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

The white lines in stacking.h were removed.
---
 src/stacking.h |   13 -
 1 file changed, 13 deletions(-)

diff --git a/src/stacking.h b/src/stacking.h
index de333e1..574ed74 100644
--- a/src/stacking.h
+++ b/src/stacking.h
@@ -20,29 +20,16 @@
 
 #ifndef WMSTACKING_H_
 #define WMSTACKING_H_
-
 void wRaiseFrame(WCoreWindow *frame);
-
 void wLowerFrame(WCoreWindow *frame);
-
 void wRaiseLowerFrame(WCoreWindow *frame);
-
 void AddToStackList(WCoreWindow *frame);
-
 void MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame);
-
 void MoveInStackListUnder(WCoreWindow *prev, WCoreWindow *frame);
-
 void RemoveFromStackList(WCoreWindow *frame);
-
 void ChangeStackingLevel(WCoreWindow *frame, int new_level);
-
 void RemakeStackList(WScreen *scr);
-
 void CommitStacking(WScreen *scr);
-
 void CommitStackingForFrame(WCoreWindow *frame);
-
 void CommitStackingForWindow(WCoreWindow * frame);
-
 #endif
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 6/6] stacking warning removed

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

The warning about if the window is in the stack list should be removed.
wwarning("RemoveFromStackingList(): window not in list ");

The reason is because we must remove the wwin->icon from the stacking
list when the application is closed, so if the window is not minimized,
then the icon is not in the window list and then cannot be removed.
---
 src/stacking.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/stacking.c b/src/stacking.c
index 890e4d1..65927cb 100644
--- a/src/stacking.c
+++ b/src/stacking.c
@@ -559,17 +559,17 @@ void MoveInStackListUnder(WCoreWindow * prev, WCoreWindow 
* frame)
WMPostNotificationName(WMNResetStacking, scr, NULL);
 }
 
-void RemoveFromStackList(WCoreWindow * frame)
+void RemoveFromStackList(WCoreWindow *frame)
 {
int index = frame->stacking->window_level;
 
-   if (XDeleteContext(dpy, frame->window, wStackContext) == XCNOENT) {
-   wwarning("RemoveFromStackingList(): window not in list ");
+   if (XDeleteContext(dpy, frame->window, wStackContext) == XCNOENT)
return;
-   }
+
/* remove from the window stack list */
if (frame->stacking->under)
frame->stacking->under->stacking->above = 
frame->stacking->above;
+
if (frame->stacking->above)
frame->stacking->above->stacking->under = 
frame->stacking->under;
else/* this was the first window on the list */
@@ -580,7 +580,7 @@ void RemoveFromStackList(WCoreWindow * frame)
WMPostNotificationName(WMNResetStacking, frame->screen_ptr, NULL);
 }
 
-void ChangeStackingLevel(WCoreWindow * frame, int new_level)
+void ChangeStackingLevel(WCoreWindow *frame, int new_level)
 {
int old_level;
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/2] WWindow has always icon - Remove wIconDestroy

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

This patch removes the wIconDestroy and the window always has icon.
This patch doesn't create the icon at the window creation! so yet
WWindow icon could be null.
---
 src/actions.c |6 +-
 src/window.c  |8 +++-
 src/wmspec.c  |   16 +---
 3 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index a79de8a..e1e6aaa 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1318,12 +1318,8 @@ void wDeiconifyWindow(WWindow *wwin)
}
 
if (!wPreferences.disable_miniwindows && wwin->icon != NULL
-   && !wwin->flags.net_handle_icon) {
+   && !wwin->flags.net_handle_icon)
RemoveFromStackList(wwin->icon->core);
-   /*removeIconGrabs(wwin->icon); */
-   wIconDestroy(wwin->icon);
-   wwin->icon = NULL;
-   }
 
if (!netwm_hidden) {
XUngrabServer(dpy);
diff --git a/src/window.c b/src/window.c
index 1cb384a..da17334 100644
--- a/src/window.c
+++ b/src/window.c
@@ -235,11 +235,17 @@ void wWindowDestroy(WWindow *wwin)
wFrameWindowDestroy(wwin->frame);
 
if (wwin->icon) {
-   RemoveFromStackList(wwin->icon->core);
+   /* If minimized, remove it form the stacking list */
+   if (!wPreferences.disable_miniwindows &&
+   !wwin->flags.net_handle_icon &&
+   wwin->flags.miniaturized)
+   RemoveFromStackList(wwin->icon->core);
+
wIconDestroy(wwin->icon);
if (wPreferences.auto_arrange_icons)
wArrangeIcons(wwin->screen_ptr, True);
}
+
if (wwin->net_icon_image)
RReleaseImage(wwin->net_icon_image);
 
diff --git a/src/wmspec.c b/src/wmspec.c
index c758f0a..f8e0029 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1053,18 +1053,6 @@ static void doStateAtom(WWindow *wwin, Atom state, int 
set, Bool init)
}
 }
 
-static void removeIcon(WWindow *wwin)
-{
-   if (wwin->icon == NULL)
-   return;
-   if (wwin->flags.miniaturized && wwin->icon->mapped) {
-   XUnmapWindow(dpy, wwin->icon->core->window);
-   RemoveFromStackList(wwin->icon->core);
-   wIconDestroy(wwin->icon);
-   wwin->icon = NULL;
-   }
-}
-
 static Bool handleWindowType(WWindow *wwin, Atom type, int *layer)
 {
Bool ret = True;
@@ -1282,9 +1270,7 @@ static Bool updateNetIconInfo(WWindow *wwin)
}
 
if (wwin->flags.miniaturized && old_state != 
wwin->flags.net_handle_icon) {
-   if (wwin->flags.net_handle_icon) {
-   removeIcon(wwin);
-   } else {
+   if (!wwin->flags.net_handle_icon) {
wwin->flags.miniaturized = False;
wwin->flags.skip_next_animation = True;
wIconifyWindow(wwin);
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/2] WWindow always has icon - Add WIcon

2012-11-18 Thread kix
From: "Rodolfo García Peñas (kix)" 

Now WWindow always has window because is created when the window
is created.

We need set the X-Position for the window, because else is placed
at 0,0. Then we set it with XMoveWindow.
---
 src/actions.c |9 ++---
 src/window.c  |9 +
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index e1e6aaa..5f9d01e 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1082,7 +1082,7 @@ static WWindow *recursiveTransientFor(WWindow * wwin)
return wwin;
 }
 
-void wIconifyWindow(WWindow * wwin)
+void wIconifyWindow(WWindow *wwin)
 {
XWindowAttributes attribs;
int present;
@@ -1114,7 +1114,8 @@ void wIconifyWindow(WWindow * wwin)
if (!wwin->flags.icon_moved)
PlaceIcon(wwin->screen_ptr, &wwin->icon_x, 
&wwin->icon_y, wGetHeadForWindow(wwin));
 
-   wwin->icon = icon_create_for_wwindow(wwin);
+   /* Update the icon pixmap */
+   update_icon_pixmap(wwin->icon);
wwin->icon->mapped = 1;
}
 
@@ -1170,8 +1171,10 @@ void wIconifyWindow(WWindow * wwin)
 
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
if (wwin->screen_ptr->current_workspace == 
wwin->frame->workspace ||
-   IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
+   IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons) {
XMapWindow(dpy, wwin->icon->core->window);
+   XMoveWindow(dpy, wwin->icon->core->window, 
wwin->icon_x, wwin->icon_y);
+   }
 
AddToStackList(wwin->icon->core);
wLowerFrame(wwin->icon->core);
diff --git a/src/window.c b/src/window.c
index da17334..a564bd9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -825,6 +825,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (WFLAGP(wwin, start_maximized) && IS_RESIZABLE(wwin))
wwin->flags.maximized = MAX_VERTICAL | MAX_HORIZONTAL;
 
+   /* FIXME: Remove this line? */
wNETWMCheckInitialClientState(wwin);
 
/* apply previous state if it exists and we're in startup */
@@ -1363,6 +1364,14 @@ WWindow *wManageWindow(WScreen *scr, Window window)
wwin = NULL;
}
 
+   if (wwin) {
+   /* Create the icon for the window */
+   wwin->icon = icon_create_for_wwindow(wwin);
+
+   /* Create the window icon */
+   wwin->net_icon_image = 
get_window_image_from_x11(wwin->client_win);
+   }
+
return wwin;
 }
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 3/6] WWindow has always icon - Remove wIconDestroy

2012-11-19 Thread kix

On 2012-11-19 09:05, Carlos R. Mafra wrote:

On Mon, 19 Nov 2012 at  0:33:37 +0100, Rodolfo García Peñas wrote:


I will try to explain it.

Before these patches:

When minimize a window, an appicon is created, and the icon is added 
to the stacking list.
When you un-minimize the icon, the icon is destroyed and is removed 
from the stacking list.


After these patches:

1. When the application is created, the appicon (wwin->icon) is 
created.
2. When the icon is minimized, the icon is added to the stacking 
list. We don't need create it.
3. When the icon is un-miminized is removed from the stacking list, 
but not destroyed.

You can repeat 2,3.
4. When the window is destroyed, the appicon is destroyed.

Now has more sense.

Problem?

If the application is minimized, the icon is in the stacking list, 
so we MUST remove it from the stacking list before destroy it, else, 
wmaker will crash. Then, the patches removes always the icon from the 
stacking list, even is not in it. We can check if the icon is in the 
stacking list testing if the icon is minimized. If minimized, then 
remove from the stacking list. Or simply remove the warning, because 
now the stacking is balanced.


Before this patch series, the icon was always removed from the 
screen when was maximized (see previous mails in the list about this 
problem). With these patches, this problem go away.


Please, don't apply patch 3 without 4 or 4 without 3. They should be 
rebased in only one, but is more easy to patch review. About patch 6, 
probably we should change the icon_destroy to test if the icon is 
minimized.


Thanks a lot for explaining the patches!

But again, the changelog is almost as important as the patches 
themselves.

All this information must be there in order to educate future people
wondering about the code, especially when there are subtle aspects 
like
removing or not the icon from the stacking list -- which btw seems a 
bit

fragile since there are assumptions being made and you must be aware
of them. People in the future will not be as fluent as you are now
regarding this, and bugs will be introduced if changes need to be 
made.


So now I will have to edit your changelogs to include this info and
probably merge patches 3 and 4 together.

Thanks though!


Thanks Carlos.
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Perhaps Cox will run Windowmaker

2012-11-19 Thread kix

Hi,

I read this article about Russ Cox. He talks about Unity "which seems 
to be a poor remake of Windowmaker without the style."


https://www.linux.com/news/special-feature/linux-developers/611198-30-linux-kernel-developers-in-30-weeks-alan-cox

Enjoy,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 01/36] get_rimage_icon_from_x11() removed

2012-11-25 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_rimage_icon_from_x11() set the window icon image
in the icon. This function is used only once and their code is so
small (only two code lines).

This patch removes the function and moves the code to wIconUpdate.
---
 src/icon.c |   18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index 13a0c94..d2c8d10 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -64,7 +64,6 @@ static void set_dockapp_in_icon(WIcon *icon);
 static void get_rimage_icon_from_icon_win(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
 static void get_rimage_icon_from_default_icon(WIcon *icon);
-static void get_rimage_icon_from_x11(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 static void unset_icon_image(WIcon *icon);
@@ -612,8 +611,12 @@ void wIconUpdate(WIcon *icon, RImage *image)
/* Get the Pixmap from the WIcon */
get_rimage_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
-   /* Use _NET_WM_ICON icon */
-   get_rimage_icon_from_x11(icon);
+   /* Remove the icon image */
+   unset_icon_image(icon);
+
+   /* Set the new icon image, use _NET_WM_ICON icon
+* (same icon that the window) */
+   icon->file_image = RRetainImage(wwin->net_icon_image);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags & 
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the 
user */
unset_icon_image(icon);
@@ -656,15 +659,6 @@ void update_icon_pixmap(WIcon *icon)
wIconPaint(icon);
 }
 
-static void get_rimage_icon_from_x11(WIcon *icon)
-{
-   /* Remove the icon image */
-   unset_icon_image(icon);
-
-   /* Set the new icon image */
-   icon->file_image = RRetainImage(icon->owner->net_icon_image);
-}
-
 static void get_rimage_icon_from_user_icon(WIcon *icon)
 {
if (icon->file_image)
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 02/36] get_rimage_icon_from_default_icon() returns image

2012-11-25 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_rimage_icon_from_default_icon() now returns the
RImage instead assign it to the icon file.

This option is better because this function can be used in other
functions to have always image in the icon.
---
 src/icon.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index d2c8d10..906dbb2 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,7 +63,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int 
coord_y);
 static void set_dockapp_in_icon(WIcon *icon);
 static void get_rimage_icon_from_icon_win(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
-static void get_rimage_icon_from_default_icon(WIcon *icon);
+static RImage *get_rimage_icon_from_default_icon(WIcon *icon);
 
 static void icon_update_pixmap(WIcon *icon, RImage *image);
 static void unset_icon_image(WIcon *icon);
@@ -664,10 +664,13 @@ static void get_rimage_icon_from_user_icon(WIcon *icon)
if (icon->file_image)
return;
 
-   get_rimage_icon_from_default_icon(icon);
+   /* Remove the icon image */
+   unset_icon_image(icon);
+
+   icon->file_image = get_rimage_icon_from_default_icon(icon);
 }
 
-static void get_rimage_icon_from_default_icon(WIcon *icon)
+static RImage *get_rimage_icon_from_default_icon(WIcon *icon)
 {
WScreen *scr = icon->core->screen_ptr;
 
@@ -675,11 +678,8 @@ static void get_rimage_icon_from_default_icon(WIcon *icon)
if (!scr->def_icon_rimage)
scr->def_icon_rimage = get_default_image(scr);
 
-   /* Remove the icon image */
-   unset_icon_image(icon);
-
/* Set the new icon image */
-   icon->file_image = RRetainImage(scr->def_icon_rimage);
+   return RRetainImage(scr->def_icon_rimage);
 }
 
 /* Get the RImage from the WIcon of the WWindow */
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 00/36] Icon changes

2012-11-25 Thread kix
From: "Rodolfo García Peñas (kix)" 

Hi,

first, sorry for this too many patches. I know I should send less patches 
together.

I will try to show the main ideas for the patches, All of them has a lot 
information, I spent more time with the commit documentation. Some patches 
could be rebased, some of them are splitted for better understanding, and other 
because I wrote the patch, I found a better way, then I create other patch, but 
I didn't rebase both patches (24 and 26 are an example) because I did that way. 
Feel free to rebase some of them.

I will describe some ideas later, but the main idea is faster code, less calls 
in the application creation flow. After these patches, to create an icon we use 
about 4 functions and 4 calls, before these patches, we use about the same 
functions (4,5), but about 12 calls.

I tested the patches, now all is ok here. But please, test the patches.

Main ideas:

1. Less wIconUpdate calls

wIconUpdate function is used to change the image for an icon. This function was 
used more times than we need. We should call this function when the icon image 
change or when we don't know if the image change. Else, should be replaced by 
wIconPaint (only paints and change the title) or update_icon_pixmap(icon) if we 
need recreate the pixmap. update_icon_pixmap(icon) will call wIconPaint()

To do it, I re-wrote some functions to return the RImage. Like:

0001-get_rimage_icon_from_x11-removed.patch
0002-get_rimage_icon_from_default_icon-returns-image.patch
0003-get_rimage_icon_from_icon_win-default-image.patch
0004-get_rimage_icon_from_icon_win-returns-image.patch

This is one of the most important ideas of these patches, and some patches to 
remove wIconUpdate are:

0012-icon_create_for_dock-without-wIconUpdate.patch
0015-create_appicon_from_dock-without-wIconUpdate.patch
0017-Dock-operations-don-t-need-wIconUpdate.patch
0018-removeAppIconFor-without-wIconUpdate.patch
0021-wIconUpdate-uses-get_window_image_def.patch
0022-Remove-wIconUpdate-wm_hints-dead-code.patch
0029-tileObserver-refresh-with-the-same-image.patch
0019-wClientCheckProperty-uses-updateIconImage.patch
0020-Icon-creation-for-wwindow-moved-to-a-function.patch

Then the code is faster and we have better possibilities, like create the icon 
in one step

0014-Aplication-creates-appicon-in-one-step.patch

2. Simplify function arguments

Some functions receives as argument an object, but only needs one thing. Is 
better send only the thing needed than the big object. For example, in th patch 
0005-get_rimage_icon_from_default_icon-WScreen-argument.patch, I changed WIcon 
by WScreen:

-static RImage *get_rimage_icon_from_default_icon(WIcon *icon);
+static RImage *get_rimage_icon_from_default_icon(WScreen *scr);

Then is possible use this function for code without icons. I used this idea 
with 0006-wm_hints-functions-argument-adjust.patch too.

3. Window images clear

We have two types of images, window image (net_icon_image) and icon image 
(WIcon->icon). I created some functions to get the window image using all 
possible methods and return the value using only one call. There are some 
patches with this code, like:

0007-Window-image-functions.patch
0008-Window-image-includes-wm_hints.patch
0011-wIconStore-already-includes-wm_hints-image.patch
0030-New-function-update_net_icon_image.patch

4. Updated the winspector, to get the right icons. I think now all icons work 
fine in winspector.c.

0009-winspector-applySettings-uses-get_window_image_from_.patch
0010-winspector-applySettings-include-all-client-images.patch
0035-wDefaultUpdateIcons-uses-wIconUpdate.patch

5. Clean code and remove dup code. When I wrote some code I clean the near 
functions. I send these clean patches as independent patches, but are not a 
deep clean.

0013-Icon-file-checking-and-dialog-function.patch
0023-Removed-get_rimage_icon_from_wm_hints.patch
0025-wGetIconName-False-block-moved-up.patch
0033-winspector.c-save-and-apply-Settings-code-clean.patch
0034-Set-the-right-icon-on-winspector-save.patch
0036-winspector.c-code-clean.patch

Now all windows have their own icon, not just when minimize it. Now we can 
change the icon in winspector.c, with the window open or minimized.

0031-WWindow-has-always-icon-Remove-wIconDestroy.patch
0032-WWindow-always-has-icon-Add-WIcon.patch

6. Some bugs. Other problems are resolved in the patches I did, not as 
independent patches. More info in the commit doc.

0016-Avoid-crash-in-icon-move-without-command.patch

7. Issues, not bugs:

0024-wIconChangeTitle-rewritten.patch
0026-wIconChangeTitle-rewrited.patch
0027-All-dockapps-have-bave-background.patch
0028-Dockapps-don-t-have-title.patch


Best regards,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 04/36] get_rimage_icon_from_icon_win() returns image

2012-11-25 Thread kix
From: "Rodolfo García Peñas (kix)" 

The function get_rimage_icon_from_icon_win() now returns a image
instead set the icon image.
---
 src/icon.c |   17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index e979a6f..df2f96c 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -61,7 +61,7 @@ static void miniwindowDblClick(WObjDescriptor * desc, XEvent 
* event);
 static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y);
 
 static void set_dockapp_in_icon(WIcon *icon);
-static void get_rimage_icon_from_icon_win(WIcon *icon);
+static RImage *get_rimage_icon_from_icon_win(WIcon *icon);
 static void get_rimage_icon_from_user_icon(WIcon *icon);
 static RImage *get_rimage_icon_from_default_icon(WIcon *icon);
 
@@ -608,8 +608,11 @@ void wIconUpdate(WIcon *icon, RImage *image)
/* Forced use user_icon */
get_rimage_icon_from_user_icon(icon);
} else if (icon->icon_win != None) {
-   /* Get the Pixmap from the WIcon */
-   get_rimage_icon_from_icon_win(icon);
+   /* Free the icon info */
+   unset_icon_image(icon);
+
+   /* Get the Pixmap from the WIcon's Window */
+   icon->file_image = get_rimage_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
/* Remove the icon image */
unset_icon_image(icon);
@@ -683,7 +686,7 @@ static RImage *get_rimage_icon_from_default_icon(WIcon 
*icon)
 }
 
 /* Get the RImage from the WIcon of the WWindow */
-static void get_rimage_icon_from_icon_win(WIcon *icon)
+static RImage *get_rimage_icon_from_icon_win(WIcon *icon)
 {
RImage *image;
 
@@ -693,11 +696,7 @@ static void get_rimage_icon_from_icon_win(WIcon *icon)
if (!image)
image = get_rimage_icon_from_default_icon(icon);
 
-   /* Free the icon info */
-   unset_icon_image(icon);
-
-   /* Set the new info */
-   icon->file_image = image;
+   return image;
 }
 
 /* Set the dockapp in the WIcon */
-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


  1   2   3   4   5   6   7   8   9   >