Subject: Re: odd highlighed window problem with 2.4.9

From: Dominik Vogt <[email-masked]>
Date: Mon, 2 Sep 2002 10:47:27 +0200

On Thu, Aug 29, 2002 at 05:39:41PM -0400, Charles Hines wrote:
> I switched to v2.4.9 the other day (from v2.4.3) and noticed this odd thing...
> I use a modified version of xbuffy (v3.3) that I changed to never take the
> focus (since it pops up a new window briefly when mail comes in), and after
> switching to v2.4.9 I noticed the focus appearing to change, but not really...
> 
> The xbuffy window will get highlighted like it's got the focus, but the focus
> never actually changes.  And I can't restore the correct window highlighting
> until I click in yet another window (I use click to focus, in case you hadn't
> guessed) and back to the original one.
> 
> I was going to look into this problem myself, but since I haven't looked at
> the code in a real long time I figured I'd be better off just asking if anyone
> has seen similar behavior first.  And since Dominik usually figures these
> things out about 2 minutes after they are posted to the list... :)

;-)  unfortunately "these things" doesn't apply to focus problems
which are hell to debug.  No way to test them in a debugger.

> If no one has any ideas off the tops of their heads, I'll look into it myself
> tommorrow.

No, sorry.  I can take a look too if you send me the modified
xbuffy sources and a minimal config file.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, mail: [email-masked], phone: 0721/91374-382
Schlund + Partner AG, Erbprinzenstr. 4-12, D-76133 Karlsruhe
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Charles Hines <[email-masked]>
Date: Tue, 03 Sep 2002 10:20:27 -0400

>>>>> "DV" == Dominik Vogt <[email-masked]> writes:

DV> On Thu, Aug 29, 2002 at 05:39:41PM -0400, Charles Hines wrote:
>> I switched to v2.4.9 the other day (from v2.4.3) and noticed this odd
>> thing...  I use a modified version of xbuffy (v3.3) that I changed to never
>> take the focus (since it pops up a new window briefly when mail comes in),
>> and after switching to v2.4.9 I noticed the focus appearing to change, but
>> not really...
>> 
>> The xbuffy window will get highlighted like it's got the focus, but the
>> focus never actually changes.  And I can't restore the correct window
>> highlighting until I click in yet another window (I use click to focus, in
>> case you hadn't guessed) and back to the original one.
>> 
>> the code in a real long time I figured I'd be better off just asking if
>> anyone has seen similar behavior first.  And since Dominik usually figures
>> these things out about 2 minutes after they are posted to the list... :)

DV> ;-)  

Thought you'd get a kick out of that statement. :)

DV> unfortunately "these things" doesn't apply to focus problems which are
DV> hell to debug.

I always thought that most low level X11 things were all pretty painful to
debug, actually. :)

DV> No way to test them in a debugger.

Don't you use something like VNC, Xnest, or XMX when doing your debugging?
Should be able to use that to run fvwm under a debugger to debug focus
problems about as "easily" as any other window manager problem, no?  Or have I
been away from working on fvwm for so long now that my memory of the pain and
difficulty of debugging certain things like focus has faded (always a
possibility) even using the above tools?

>> If no one has any ideas off the tops of their heads, I'll look into it
>> myself tommorrow.

Which I did, but didn't get very far.  The code has changed so much that I
felt quite lost looking through it and gave up sooner than I should have (of
course, work was also interfering).

DV> No, sorry.  I can take a look too if you send me the modified
DV> xbuffy sources and a minimal config file.

I'll do one better.  I've attached a version of a dirt simple X11 (Xt) program
that someone else posted to the list once to demonstrate another problem,
modified to essentially contain the same changes that I did to xbuffy.

Shows the same behavior of switching the highlight when clicked in, and I
tested it under the fvwm 2.4.3 that I still had lying around and there it
works as expected (no highlight switch, except temporarily when grabbing the
title bar to move the window but it immedieately switches back).

If you don't get a chance to look into it, I'll try again myself later today
(or tonight at home if I remember to mail this little testcase back there).

Thanks,
Chuck

-- 
Charles K. Hines   <[email-masked]>   <[email-masked]>
Principal Scientist at ReQuest Technologies Inc   (http://www.ReQuestTech.com/)

  "dis ting could have possabiwities if I put my twisted widdle mind to it!"
                                                        - Bugs Bunny

#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>

int main(int argc, char **argv) 
{   
  XtAppContext appContext;
  Display *display;
  Widget shell;
  Arg al[2];
  short ac = 0;

  XtToolkitInitialize();
  appContext = XtCreateApplicationContext();
  display = XtOpenDisplay(appContext, 0, argv[0], argv[0], 0, 0, &argc,
                          argv);
  XtSetArg(al[ac], XtNheight, 500); ac++;
  XtSetArg(al[ac], XtNwidth, 500); ac++;
  shell = XtAppCreateShell(0, "shell", applicationShellWidgetClass,
                           display, al, ac);

  { /* CKH - don't want window to get focus... */
    XWMHints hints;
    Atom at;

    hints.flags = InputHint;
    hints.input = False;

    if (!XtIsRealized(shell))
    {
      XtRealizeWidget(shell);
    }

    XSetWMHints(display, XtWindow(shell), &hints);
    at = XInternAtom(display,"WM_TAKE_FOCUS",False);
    XDeleteProperty(display,XtWindow(shell),at);
  }

  XtPopup(shell, XtGrabNone);
  XtAppMainLoop(appContext);

  return 0;
}

---

From: Charles Hines <[email-masked]>
Date: Tue, 03 Sep 2002 10:27:41 -0400

>>>>> "Me" == Charles Hines <[email-masked]> writes:

Me> I'll do one better.  I've attached a version of a dirt simple X11 (Xt)
Me> program that someone else posted to the list once to demonstrate another
Me> problem, modified to essentially contain the same changes that I did to
Me> xbuffy.

Me> Shows the same behavior of switching the highlight when clicked in, and I
Me> tested it under the fvwm 2.4.3 that I still had lying around and there it
Me> works as expected (no highlight switch, except temporarily when grabbing
Me> the title bar to move the window but it immedieately switches back).

Actually, I just noticed that the FvwmPager module also exhibits this same
behavior, both incorrectly in 2.4.9 and correctly in 2.4.3.

Chuck

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 3 Sep 2002 16:39:22 +0200

On Tue, Sep 03, 2002 at 10:20:27AM -0400, Charles Hines wrote:
Content-Description: message body and .signature
> problems about as "easily" as any other window manager problem, no?

Sure, I use Xnest et al. quite a lot.  The problem is:  to use the
debugger I have to focus it ruining the debug session.  I rarely
start a separate X server because XFree 4.x crashes or hangs most
of the time when I do this (for debugging).

> Or have I

Later.

Bye

Dominik ^_^  ^_^

---

From: Charles Hines <[email-masked]>
Date: Tue, 03 Sep 2002 11:03:43 -0400

>> problems about as "easily" as any other window manager problem, no?

DV> Sure, I use Xnest et al. quite a lot.  The problem is:  to use the
DV> debugger I have to focus it ruining the debug session.  

But if you run the debugger in a window in your main X11 session it's focus is
totally seperate from the focus of the fvwm/X11 session running in Xnest (or
VNC or XMX) so it shouldn't be an issue, no?

DV> I rarely start a separate X server because XFree 4.x crashes or hangs most
DV> of the time when I do this (for debugging).

Ugh, you mean when you start another X11 session on another virtual terminal
under Linux?  Bummer...sounds like a little bug in the XFree86 drivers for
your graphics card.

Chuck

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 3 Sep 2002 17:24:14 +0200

> VNC or XMX) so it shouldn't be an issue, no?

It's a bit hard to get the pointer out of the Xnest window without
moving the mouse.  Most of the time it's more trouble than using
debug fprintfs.

> under Linux?

Yup.

> Bummer...sounds like a little bug in the XFree86 drivers for
> your graphics card.

Maybe, but maybe not.  XFree 3.x worked fine most of the time, but
with XFree 4.x things got a lot worse, even with the same gfx
card.  Also, switching X servers generates some funny and unwanted
mouse events on the server switched to.

Bye

Dominik ^_^  ^_^

---

From: Charles Hines <[email-masked]>
Date: Tue, 03 Sep 2002 14:22:40 -0400

>>>>> "DV" == Dominik Vogt <[email-masked]> writes:

DV> On Tue, Sep 03, 2002 at 11:03:43AM -0400, Charles Hines wrote:

DV> It's a bit hard to get the pointer out of the Xnest window without
DV> moving the mouse.  Most of the time it's more trouble than using
DV> debug fprintfs.

Alright, I see the problem now...it definitely has been too long since I had
to debug fvwm... :)

Should be less of an issue with click to focus type situations though, and for
the other focus types games could be played by having the window you're going
to focus to be at the edge of the screen so you can move the mouse out of the
Xnest window without the virtual Xnest mouse leaving the the window you want
to focus.  May have to turn off EdgeScroll though.

>> Ugh, you mean when you start another X11 session on another virtual terminal

DV> Yup.

>> Bummer...sounds like a little bug in the XFree86 drivers for

DV> Maybe, but maybe not.  XFree 3.x worked fine most of the time, but
DV> with XFree 4.x things got a lot worse, even with the same gfx
DV> card.  Also, switching X servers generates some funny and unwanted
DV> mouse events on the server switched to.

Interesting...

Later,
Chuck

---

From: Charles Hines <[email-masked]>
Date: Tue, 10 Sep 2002 14:27:20 -0400

>>>>> "Me" == Charles Hines <[email-masked]> writes:

...
Me> If you don't get a chance to look into it, I'll try again myself later
Me> today (or tonight at home if I remember to mail this little testcase back
Me> there).

I finially got around to looking into this problem, and turned out that
finding where the problem and coming up with a workable fix was actually
rather easy:

===========================================================================
--- events.c~   Thu Jul 18 05:45:28 2002
+++ events.c    Tue Sep 10 14:21:14 2002
@@ -1754,7 +1754,7 @@
     }
     if (!IS_ICONIFIED(Tmp_win))
     {
-      DrawDecorations(Tmp_win, DRAW_ALL, True, True, PressedW);
+      DrawDecorations(Tmp_win, DRAW_ALL, (Tmp_win == get_focus_window()), True, PressedW);
     }
   }
   else if (Tmp_win && Event.xbutton.window == Tmp_win->Parent &&
===========================================================================

At least, that seemed to make things behave properly for me.

Later,
Chuck

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 12 Sep 2002 17:21:24 +0200

> finding where the problem and coming up with a workable fix was actually

And it's the right fix too.

Welcome back to the fvwm developer community.  We'd be happy to
give you cvs commit rights if you want them :-)

I have applied the patch.  Was this also a problem in 2.5.x?  I
guess not since the faulty code was already removed, but I did not
try it out myself.

Bye

Dominik ^_^  ^_^

---

From: Charles Hines <[email-masked]>
Date: Thu, 12 Sep 2002 14:01:22 -0400

>>>>> "DV" == Dominik Vogt <[email-masked]> writes:

DV> On Tue, Sep 10, 2002 at 02:27:20PM -0400, Charles Hines wrote:
...
>> finding where the problem and coming up with a workable fix was actually

DV> And it's the right fix too.

And there was much rejoicing... :)

...
>> At least, that seemed to make things behave properly for me.

DV> Welcome back to the fvwm developer community.  

I'd hardly constitute this piddly little patch as my return to fvwm
development. :)

DV> We'd be happy to give you cvs commit rights if you want them :-)

Have to pass for now as our firewall at work won't let cvs through and I still
don't know how much I'd be able to get away with doing from home right now
either, but thanks anyways!  Maybe someday...

Speaking of cvs access, however, wasn't it possible in the past to browse the
cvs repository for fvwm via the cvsweb interface?  The bookmark that I had to
that no longer works and no amount of guessing (or looking over the links on
the fvwm website) could find it.

DV> I have applied the patch.  Was this also a problem in 2.5.x?  I
DV> guess not since the faulty code was already removed, but I did not
DV> try it out myself.

Don't know, let me grab the code and check it out...assume it's not unless I
send another message to the contrary... :)

Thanks,
Chuck

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 12 Sep 2002 21:57:50 +0200

> I'd hardly constitute this piddly little patch as my return to fvwm

A little prodding never hurts :-)

> the fvwm website) could find it.

  ftp://ftp.fvwm.org/pub/fvwm/devel/snapshots/

The info is on the "cvs" sub page.

> send another message to the contrary... :)

I'd rather assume it's fixed unless you state otherwise :)  I
rewrote the border drawing logic completely in 2.5.x and that
statement fell prey to my work.  I looked through all other
border_draw_decorations() calls in events.c (latest CVS) and that
argument seems to be set correctly everywhere.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Charles Hines <[email-masked]>
Date: Thu, 12 Sep 2002 17:37:58 -0400

>>>>> "Dominik" == Dominik Vogt <[email-masked]> writes:

>> I'd hardly constitute this piddly little patch as my return to fvwm

Dominik> A little prodding never hurts :-)

True. :)

And hopefully I shall truly return someday...

...
>> Speaking of cvs access, however, wasn't it possible in the past to browse
>> the cvs repository for fvwm via the cvsweb interface?  The bookmark that I
>> had to that no longer works and no amount of guessing (or looking over the
>> links on the fvwm website) could find it.

Dominik>   ftp://ftp.fvwm.org/pub/fvwm/devel/snapshots/

Dominik> The info is on the "cvs" sub page.

Oh I knew about the snapshots, I was referring to actually surfing through the
cvs repository via the cvsweb interface.  Here's the link I had bookmarked:

  http://www.hpc.uh.edu/cgi-bin/cvsweb.cgi/fvwm/?cvsroot=FVWM&hideattic=1&sortbydate=0

and I remember using it a couple of times, but that doesn't seem to work any
more and I all my attempts to guess what might be the current correct URL were
sadly incorrect.

Jason, does the cvsweb stuff for fvwm still exist anywhere by any chance?

>> send another message to the contrary... :)

Dominik> I'd rather assume it's fixed unless you state otherwise :)  

Doh!  That's what I meant to say...  Oh wait, I see why I worded it that way.
You said "was this also a problem" so I was replying "assume it's not [a
problem] unless I send another message" where the [a problem] was implied but
easily confused with [fixed].

Note that I hate (and often abuse) English...sometimes it's hard to guess that
it's my native tongue. :)

Dominik> I rewrote the border drawing logic completely in 2.5.x 

So I noticed.

Dominik> and that statement fell prey to my work.  I looked through all other
Dominik> border_draw_decorations() calls in events.c (latest CVS) and that
Dominik> argument seems to be set correctly everywhere.

And I did download 2.5.3 and verify that it worked fine there.

On an unrelated note, I was "forced" to use gcc to compile v2.5.3 (normally I
use Sun's Forte compiler on my Solaris box here at work) due to the use of the
__attribute__ macro.  I probably could have gotten around it pretty easily by
using the #define for it in vms/config.h (assuming that there aren't any other
gcc-isms in there) but it was quicker to just use gcc instead.

I hope you're not requiring gcc now and that this was just an accident... :)

Just thought I'd mention it if you or someone else haven't fixed that already.
And if you haven't, I might be pursuaded to submit another patch if you'd
like. :)

Chuck

---

From: Jason L Tibbitts III <[email-masked]>
Date: 12 Sep 2002 16:44:22 -0500

>>>>> "CH" == Charles Hines <[email-masked]> writes:

CH> Jason, does the cvsweb stuff for fvwm still exist anywhere by any
CH> chance?

No, it doesn't.  It never survived the last CVS server move.  As I'll
be moving it again anyway, I may try to get something like cvsweb
going again then.

 - J<

---

From: "Paul Smith" <[email-masked]>
Date: 12 Sep 2002 17:50:55 -0400

If you're setting it up from scratch I suggest you go with viewcvs
instead of cvsweb; the former is nicer (and, unless things have changed
recently, much better supported):

  http://viewcvs.sourceforge.net/

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]> HASMAT--HA Software Mthds & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Jason L Tibbitts III <[email-masked]>
Date: 12 Sep 2002 16:59:03 -0500

>>>>> "PS" == Paul Smith <[email-masked]> writes:

PS> If you're setting it up from scratch I suggest you go with viewcvs
PS> instead of cvsweb; 

Yep; I was looking at either that or Chora (www.horde.org/chora).  I
think I prefer Chora, honestly, and I already run the Horde suite here
for webmail, calendaring, etc.

 - J<

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 13 Sep 2002 11:24:50 +0200

> Dominik> On Thu, Sep 12, 2002 at 02:01:22PM -0400, Charles Hines wrote:

[snip]

>   http://www.hpc.uh.edu/cgi-bin/cvsweb.cgi/fvwm/?cvsroot=FVWM&hideattic=1&sortbydate=0

Most of the hpc.uh.edu links don't work anymore since Jason moved
the website to a different machine (right?).

I didn't post the link I wanted to post.  Here's the correct one:

  ftp://ftp.fvwm.org/pub/fvwm/devel/sources/

> Jason, does the cvsweb stuff for fvwm still exist anywhere by any chance?

[snip] 

> it's my native tongue. :)

[snip]

> And I did download 2.5.3 and verify that it worked fine there.

Phew!

> I hope you're not requiring gcc now and that this was just an accident... :)

According to the ChangeLog:

  2002-03-27  Dominik Vogt  <[email-masked]>
      
        * libs/fvwmlib.h:
        * fvwm/fvwm.h:
        * config.h.in:
        moved gcc extension __attribute__ handling to config.h

But the __attribute__ handling isn't in config.h.  This isn't
exactly a surprise since config.h.in is generated automatically.
A legacy of the time when I knew little about autoconf and
automake.

> And if you haven't, I might be pursuaded to submit another patch if you'd

Sure.  Everything I don't have to do myself is very welcome :)
Basically you just have to copy the "#ifndef __attribute__" chunk
from libs/fvwmlib.h in the 2.4 branch to the @bottom@ section of
acconfig.h.

Bye

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 13 Sep 2002 09:32:54 +0000

On 13 Sep 2002 11:24:50 +0200, Dominik Vogt wrote:
> 
> > I might be pursuaded to submit another patch if you'd like. :)
> 

I don't think we need another send patch/comment on patch/apply patch
round. :) I will commit the fix.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 13 Sep 2002 12:06:58 +0200

> round. :) I will commit the fix.

Hey, it would have taken me just about 2 minutes to do that
myself.  I just wanted that Chuck gets more comfortable with the
thought of contributing again :)

Bye

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 13 Sep 2002 10:14:58 +0000

> thought of contributing again :)

Sure, but would not it be more comfortable to have cvs write access rather
then sending patches? I am all for giving people cvs access.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 13 Sep 2002 12:58:57 +0200

> then sending patches? I am all for giving people cvs access.

Sure, that's what I said.  But Chuck mumbles something about a
firewall blocking CVS access.

Bye

Dominik ^_^  ^_^