[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
focuswp and MwDestroyWindow
From: Shivaji Navale ####@####.#### Date: 25 Oct 2004 18:28:37 +0100 Message-Id: <40492.10.107.1.1.1098724963.squirrel@pc2.ee.iitb.ac.in> Hi, In microwindows focuswp is a (global) holding the focused window hwnd. say MwDestroyWindow is called on destroywp for our case. If destroywp is in focus without parent, everything goes on well, However if destroywp is in focus (with parent) the check before SetFocus is not true and the focuswp is not changed even after the window deletion. The problem is if we create hwnd's with a single parent and want to destroy one of the hwnds, the focuswp remains unaltered. And on a subsequent setfocus for <snip> oldfocus = focuswp; SendMessage(oldfocus,..) <snip> we get a segfault. so for a win 32 implemented code we had to apply a check for the same in MwDestroyWindow. <snip> //additional 2 lines follow % if(wp == focuswp) % SetFocus(rootwp->children? rootwp->children: rootwp); if(wp == MwGetTopWindow(focuswp)) SetFocus(rootwp->children? rootwp->children: rootwp); <snip> instead of current implementation. This should take care of maintaining the global focuswp consistently for destroywindow with or without parent Has anybody digged this issue deeper, and would like to share their views. What will be an appropriate microwindows solution. Please let me know if this needs further clarification. Regards Shivaji | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] focuswp and MwDestroyWindow
From: "MrWGT" ####@####.#### Date: 25 Oct 2004 21:10:25 +0100 Message-Id: <200410252010.i9PKALXQ028414@post.webmailer.de> Hi... i came across the same problem some month ago. I solved it that way (maybe not the best solution but up to now it works): old source: /* * Destroy all children, sending WM_DESTROY messages. */ while (wp->children) MwDestroyWindow(wp->children, bSendMsg); new source: /* * Destroy all children, sending WM_DESTROY messages. */ while (wp->children) { if (wp->children == focuswp) focuswp = MwGetTopWindow(focuswp); MwDestroyWindow(wp->children, bSendMsg); } >so for a win 32 implemented code we had to apply a check for the same in >MwDestroyWindow. ><snip> >//additional 2 lines follow >% if(wp == focuswp) >% SetFocus(rootwp->children? rootwp->children: rootwp); >if(wp == MwGetTopWindow(focuswp)) >SetFocus(rootwp->children? rootwp->children: rootwp); I think that your solution to set/correct the focuswp just before the original code should work. But i would focus the parent if there's one instead of the rootwp or the first child. // 1) New: If wp is focused set focus to parent (if wp is child) if (wp == focuswp) SetFocus(MwGetTopWindow(focuswp)); // 2) Original: If wp is parent of focuswp set focus to other rootwp or first child of rootwp if (wp == MwGetTopWindow(focuswp)) SetFocus(rootwp->children? rootwp->children: rootwp); Kind regards, Gerd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] focuswp and MwDestroyWindow
From: Shivaji Navale ####@####.#### Date: 27 Oct 2004 09:46:34 +0100 Message-Id: <54532.10.107.1.1.1098860026.squirrel@pc2.ee.iitb.ac.in> Hi, Can such a fix be taken in the next Microwindows release. Thanks Gred, for sharing your solution for this issue. Gred's patch will take care of maintaining focuswp 1. destroying focuswp 2. destroying wp whose child is focuswp that works and is good enough. What I would further suggest, is to have one more focus global, say oldfocus, and set focus to it (after validating oldfocus) instead of setting it to Top parent window, on destroyWindow. Regards Shivaji. > Hi... > > i came across the same problem some month ago. I solved it that way > (maybe not the best solution but up to now it works): > > old source: > > /* > * Destroy all children, sending WM_DESTROY messages. > */ > while (wp->children) > MwDestroyWindow(wp->children, bSendMsg); > > new source: > > /* > * Destroy all children, sending WM_DESTROY messages. > */ > while (wp->children) > { > if (wp->children == focuswp) > focuswp = MwGetTopWindow(focuswp); > MwDestroyWindow(wp->children, bSendMsg); > } > >>so for a win 32 implemented code we had to apply a check for the same >> in MwDestroyWindow. > >><snip> >>//additional 2 lines follow >>% if(wp == focuswp) >>% SetFocus(rootwp->children? rootwp->children: rootwp); > >>if(wp == MwGetTopWindow(focuswp)) >>SetFocus(rootwp->children? rootwp->children: rootwp); > > I think that your solution to set/correct the focuswp just before the > original code should work. But i would focus the parent if there's one > instead of the rootwp or the first child. > > // 1) New: If wp is focused set focus to parent (if wp is child) > if (wp == focuswp) > SetFocus(MwGetTopWindow(focuswp)); > > // 2) Original: If wp is parent of focuswp set focus to other rootwp > or > first child of rootwp if (wp == MwGetTopWindow(focuswp)) > SetFocus(rootwp->children? rootwp->children: rootwp); > > Kind regards, > > Gerd > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ####@####.#### > For additional commands, e-mail: ####@####.#### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |