El 26.06.2012 10:32, Rodolfo kix Garcia escribió:
El 26.06.2012 01:12, Carlos R. Mafra escribió:
On Mon, 25 Jun 2012 at 23:48:51 +0200, Rodolfo García Peñas wrote:

Subject: [PATCH 07/11] net_state_from_client can be removed

The variable net_state_from_client don't change their value in the
code, therefore, we don't need check it in any "if".
---
 src/window.h |    1 -
 src/wmspec.c |    4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/window.h b/src/window.h
index e2d516a..ae1e704 100644
--- a/src/window.h
+++ b/src/window.h
@@ -290,7 +290,6 @@ typedef struct WWindow {

         unsigned int user_changed_width:1;
         unsigned int user_changed_height:1;
- unsigned int net_state_from_client:1; /* state hint was set by client */
         unsigned int net_skip_pager:1;
         unsigned int net_handle_icon:1;
         unsigned int net_show_desktop:1;
diff --git a/src/wmspec.c b/src/wmspec.c
index 9456841..ae870ea 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -795,9 +795,7 @@ static void updateWorkspaceHint(WWindow * wwin, Bool fake, Bool del) static void updateStateHint(WWindow * wwin, Bool changedWorkspace, Bool del)
 {                              /* changeable */
        if (del) {
-               if (!wwin->flags.net_state_from_client) {
-                       XDeleteProperty(dpy, wwin->client_win, net_wm_state);
-               }
+               XDeleteProperty(dpy, wwin->client_win, net_wm_state);

I don't know. I wonder if we should try to look where and when
we should set this variable.

I had the same question. Can I remove this?

net_state_from_client is defined in the struct, but never is
initalized. Then, is used in the "if".
Normally, the compiler can init a value to 0 (or not!). Then, this
could be an error.

What I did? I added a printfs, something like:

        if (del) {
                printf("1\n");
        if (!wwin->flags.net_state_from_client) {
                        printf("2\n");
                XDeleteProperty(dpy, wwin->client_win, net_wm_state);
        }

And then I runned windowmaker some time. Open windows,... I always
get "1\n2\n" on the screen. If I got a 1, then I got a 2. That make
sense, because the value of wwin->flags.net_state_from_client should
be "0" (compiler init), then "if (!0)" is like "true".

For this reason, I remove the "if".

I any case, we should do something. Now the value depends in if the
compiler init or not the value. Do you like this code?

int main(void)
{
  int a;

  if (!a)
    printf("No a\n");
}

The compiler will show a warning, because "a" is not initialized.
IMO, is the same case (I'm the compiler ;-) ).

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

I know that the patch was applied, but I am trying to show why I did that change.

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


--
To unsubscribe, send mail to [email protected].

Reply via email to