Comments on focusing (on new code in CVS)

Iban Hatchondo hatchond at labri.fr
Tue Mar 25 00:36:02 UTC 2003


Erik Enge wrote:
> Erik Enge <eenge at prium.net> writes:
> 
> 
>>  - If I have two windows.  Window 1 is focused and window 2 is behind
>>  window 1 but I can see both.  If I now hit the maximize button on
>>  window 2, I'd expect it to become focused as well as maximized.
>>  Currently, it only gets maximized.
> 
> 
> I'm trying to fix that with the following code in input.lisp:
> 
>   ;; Maximization
>   (defmethod event-process ((event button-release) (max-b maximize-button))
>     (when (< (event-code event) 4)
>       (with-slots (master window) max-b
>         (when (eq *focus-type* :on-click)
>           (vs:restack-window window (vs:nth-vscreen (root-vscreens *root*))))
>         (when master (draw-focused-decoration master))
>         (setf (netwm:net-active-window *root-window*) window))
>       (maximize-window (button-master max-b) (event-code event))))
> 

[ snip ]

> 
> As the attached screenshot shows, the window is maximized and partly
> focused.  Two problems exist: 

I can't see any attached files.

>   "partly focused" - as you can see (screenshot) the bigger window (the
>   one just maximized) is not focused (or has not loaded the pixmap that
>   represents the focusing) the title-bar.  I can't explain why.
> 
>   The window that was previously focus is, well, still focused.  :) Do I
>   need to call some more code to defocus the current window before
>   focusing a new one, perhaps?
> 
> Thanks for any help,

I think you went the wrong way:
  - if you use draw-focused-decoration, the decoration should be focused 
what is not the fact here.
Why don't you just try to call (focus-widget max-b 0) ?
It will gives the focus to the decoration according to focus rules (in 
wm.lisp) and the X events will do the rest: now the application got 
focus (according focus rules), a focus-in event will be generate on our 
display. And so, the event-process method for focus-in will be called. 
This method will restack the window if needed, draw focused decoration 
if decorated, and set the net-active-window property.

(defmethod event-process ((event button-release) (max-b maximize-button))
   (when (< (event-code event) 4)
     (maximize-window (button-master max-b) (event-code event))
     (focus-widget max-b 0)))

!ban.





More information about the eclipse-devel mailing list