Path: utzoo!attcan!uunet!husc6!bloom-beacon!gatech!rutgers!ucsd!ucbvax!hplabs!hp-pcd!hpcvlx!fred
From: fred@hpcvlx.HP.COM (Fred Taft)
Newsgroups: comp.windows.x
Subject: Re: HP's Xtk Bug Fixes
Message-ID: <1610034@hpcvlx.HP.COM>
Date: 15 Aug 88 18:11:08 GMT
References: <1610032@hpcvlx.HP.COM>
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 41

VERSION:
	Xtk release 2

SYNOPSIS:
	AddForwardingHandler() does not take window borders into
        consideration when checking if cursor is in a window.

DESCRIPTION:
	AddForwardingHandler(), which is part of the input focus
        mechanism within Xtk, does not take window borders into
        consideration when it checks to see if the cursor is already
        in the window to which the focus is being set.  This causes
        the widget to not get the initial FocusIn event, which is also
        generated by AddForwardingHandler().

FIX:

/* The following is a patch to Event.c */

997a998
>     int ul_x, lr_x, ul_y, lr_y;
1047,1048c1048,1063
< 	if (win_x >= 0 && win_x < widget->core.width &&
< 	    win_y >= 0 && win_y < widget->core.height) {
---
> 
>         /*
>          * The work variables are necessary because
>          * the core's height and width fields are unsigned, and win_x and
>          * win_y may be negative; if they are, then the comparison can fail
>          * when it shouldn't.  Additionally, the widget's borders need to
>          * be considered in this calculation.
>          */
>         ul_x = (int)(0 - widget->core.border_width);
>         ul_y = (int)(0 - widget->core.border_width);
>         lr_x = (int)(widget->core.width + (widget->core.border_width << 1));
>         lr_y = (int)(widget->core.height + (widget->core.border_width << 1));
> 
> 	if ((win_x >= ul_x) && (win_x < lr_x) &&
> 	   (win_y >= ul_y) && (win_y < lr_y))
>         {