From af8cd564b2746c6c9737cd7f9c7e679cd3f70981 Mon Sep 17 00:00:00 2001 From: Alexey I. Froloff Date: Sat, 10 Apr 2010 17:33:03 +0400 Subject: [PATCH] Dropped buggy keyboard traversal support --- neXtaw/X11/neXtaw/Command.c | 24 +-- neXtaw/X11/neXtaw/List.c | 9 +- neXtaw/X11/neXtaw/Makefile.am | 3 +- neXtaw/X11/neXtaw/Makefile.in | 3 +- neXtaw/X11/neXtaw/Panner.c | 7 +- neXtaw/X11/neXtaw/Repeater.c | 19 +- neXtaw/X11/neXtaw/Scrollbar.c | 25 +-- neXtaw/X11/neXtaw/Simple.c | 19 +- neXtaw/X11/neXtaw/Template.c | 17 +- neXtaw/X11/neXtaw/Text.c | 3 +- neXtaw/X11/neXtaw/TextTr.c | 4 +- neXtaw/X11/neXtaw/Toggle.c | 17 +- neXtaw/X11/neXtaw/Traversal.c | 655 ---------------------------------------- neXtaw/X11/neXtaw/Traversal.h | 158 ---------- neXtaw/X11/neXtaw/TraversalP.h | 189 ------------ neXtaw/X11/neXtaw/XawVersion.h | 1 - 16 files changed, 18 insertions(+), 1135 deletions(-) delete mode 100644 neXtaw/X11/neXtaw/Traversal.c delete mode 100644 neXtaw/X11/neXtaw/Traversal.h delete mode 100644 neXtaw/X11/neXtaw/TraversalP.h diff --git a/neXtaw/X11/neXtaw/Command.c b/neXtaw/X11/neXtaw/Command.c index 0ea6588..4114cba 100644 --- a/neXtaw/X11/neXtaw/Command.c +++ b/neXtaw/X11/neXtaw/Command.c @@ -61,7 +61,6 @@ SOFTWARE. #include "XawInit.h" #include "CommandP.h" #include "ToggleP.h" -#include "TraversalP.h" #include #include #ifdef XPM_TILE @@ -79,31 +78,10 @@ SOFTWARE. /* Private Data */ static char defaultTranslations[] = -#if 0 /* from neXtaw */ ": highlight() \n\ : reset() \n\ : set() \n\ : notify() unset() "; -#else /* from XawM */ -" : FocusEnterWindow() \n\ - : highlight() \n\ - : FocusLeaveWindow() \n\ - : reset() \n\ - : set() \n\ - : notify() unset() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() \n\ - Home: FocusHome() \n\ - End: FocusEnd() \n\ - Up: FocusPreviousGroup() \n\ - Down: FocusNextGroup() \n\ - KP_Home: FocusHome() \n\ - KP_End: FocusEnd() \n\ - KP_Up: FocusPreviousGroup() \n\ - KP_Down: FocusNextGroup() \n\ - space: set() \n\ - space: notify() unset() "; -#endif #define offset(field) XtOffsetOf(CommandRec, field) static XtResource resources[] = { @@ -171,7 +149,7 @@ CommandClassRec commandClassRec = { NULL, /* set_values_hook */ XtInheritSetValuesAlmost, /* set_values_almost */ NULL, /* get_values_hook */ - XawAcceptFocus, /* accept_focus */ + XtInheritAcceptFocus, /* accept_focus */ XtVersion, /* version */ NULL, /* callback_private */ defaultTranslations, /* tm_table */ diff --git a/neXtaw/X11/neXtaw/List.c b/neXtaw/X11/neXtaw/List.c index 9bb2a26..2296f50 100644 --- a/neXtaw/X11/neXtaw/List.c +++ b/neXtaw/X11/neXtaw/List.c @@ -47,7 +47,6 @@ in this Software without prior written authorization from the X Consortium. #include "XawInit.h" #include "ListP.h" -#include "TraversalP.h" /* These added so widget knows whether its height, width are user selected. I also added the freedoms member of the list widget part. */ @@ -66,11 +65,7 @@ I also added the freedoms member of the list widget part. */ static char defaultTranslations[] = ": Set() \n\ - : Notify() \n\ - : FocusEnterWindow() \n\ - : FocusLeaveWindow() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() "; + : Notify() "; /**************************************************************** * @@ -161,7 +156,7 @@ ListClassRec listClassRec = { /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, - /* accept_focus */ XawAcceptFocus, + /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ defaultTranslations, diff --git a/neXtaw/X11/neXtaw/Makefile.am b/neXtaw/X11/neXtaw/Makefile.am index c8d64f0..510bf2e 100644 --- a/neXtaw/X11/neXtaw/Makefile.am +++ b/neXtaw/X11/neXtaw/Makefile.am @@ -8,7 +8,7 @@ libneXtaw_la_SOURCES = \ Sme.c SmeBSB.c SmeLine.c SmeThreeD.c StripChart.c Text.c \ TextAction.c TextPop.c TextSink.c TextSrc.c TextTr.c TextTrOld.c \ ThreeD.c \ - Toggle.c Traversal.c \ + Toggle.c \ Tree.c Vendor.c Viewport.c XawI18n.c XawIm.c XawInit.c \ sharedlib.c laygram.c laylex.c @@ -26,7 +26,6 @@ neXtawinclude_HEADERS = \ SmeLine.h SmeLineP.h SmeP.h SmeThreeD.h SmeThreeDP.h \ StripCharP.h StripChart.h Text.h TextP.h TextSink.h TextSinkP.h \ TextSrc.h TextSrcP.h ThreeD.h ThreeDP.h Toggle.h ToggleP.h \ - Traversal.h TraversalP.h \ Tree.h TreeP.h VendorEP.h Viewport.h ViewportP.h \ XawAlloc.h XawI18n.h XawImP.h XawInit.h XawVersion.h laygram.h diff --git a/neXtaw/X11/neXtaw/Makefile.in b/neXtaw/X11/neXtaw/Makefile.in index a0224d0..74ec066 100644 --- a/neXtaw/X11/neXtaw/Makefile.in +++ b/neXtaw/X11/neXtaw/Makefile.in @@ -92,7 +92,7 @@ libneXtaw_la_SOURCES = \ Sme.c SmeBSB.c SmeLine.c SmeThreeD.c StripChart.c Text.c \ TextAction.c TextPop.c TextSink.c TextSrc.c TextTr.c TextTrOld.c \ ThreeD.c \ - Toggle.c Traversal.c \ + Toggle.c \ Tree.c Vendor.c Viewport.c XawI18n.c XawIm.c XawInit.c \ sharedlib.c laygram.c laylex.c @@ -111,7 +111,6 @@ neXtawinclude_HEADERS = \ SmeLine.h SmeLineP.h SmeP.h SmeThreeD.h SmeThreeDP.h \ StripCharP.h StripChart.h Text.h TextP.h TextSink.h TextSinkP.h \ TextSrc.h TextSrcP.h ThreeD.h ThreeDP.h Toggle.h ToggleP.h \ - Traversal.h TraversalP.h \ Tree.h TreeP.h VendorEP.h Viewport.h ViewportP.h \ XawAlloc.h XawI18n.h XawImP.h XawInit.h XawVersion.h laygram.h diff --git a/neXtaw/X11/neXtaw/Panner.c b/neXtaw/X11/neXtaw/Panner.c index 51946ec..a9a994d 100644 --- a/neXtaw/X11/neXtaw/Panner.c +++ b/neXtaw/X11/neXtaw/Panner.c @@ -32,7 +32,6 @@ in this Software without prior written authorization from the X Consortium. #include /* for XmuCompareISOLatin1() */ #include "XawInit.h" /* for XawInitializeWidgetSet */ #include "PannerP.h" /* us */ -#include "TraversalP.h" #include #include /* for Min */ #include @@ -51,10 +50,6 @@ static char defaultTranslations[] = : move() \n\ : notify() stop() \n\ : abort() \n\ - : FocusEnterWindow() \n\ - : FocusLeaveWindow() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() \n\ :KP_Enter: set(rubberband,toggle) \n\ space: page(+1p,+1p) \n\ Delete: page(-1p,-1p) \n\ @@ -168,7 +163,7 @@ PannerClassRec pannerClassRec = { /* set_values_hook */ NULL, /* set_values_almost */ SetValuesAlmost, /* get_values_hook */ NULL, - /* accept_focus */ XawAcceptFocus, + /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ defaultTranslations, diff --git a/neXtaw/X11/neXtaw/Repeater.c b/neXtaw/X11/neXtaw/Repeater.c index 64fd8c0..fd95af3 100644 --- a/neXtaw/X11/neXtaw/Repeater.c +++ b/neXtaw/X11/neXtaw/Repeater.c @@ -33,7 +33,6 @@ in this Software without prior written authorization from the X Consortium. #include /* for XtN and XtC defines */ #include "XawInit.h" /* for XawInitializeWidgetSet() */ #include "RepeaterP.h" /* us */ -#include "TraversalP.h" static void tic(); /* clock timeout */ @@ -56,22 +55,8 @@ static void tic(); /* clock timeout */ * Translations to give user interface of press-notify...-release_or_leave */ static char defaultTranslations[] = - ": FocusEnterWindow() \n\ - : highlight() \n\ - : FocusLeaveWindow() \n\ - : unhighlight() \n\ - space: set() start() \n\ - space: stop() unset() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() \n\ - Home: FocusHome() \n\ - End: FocusEnd() \n\ - Up: FocusPreviousGroup() \n\ - Down: FocusNextGroup() \n\ - KP_Home: FocusHome() \n\ - KP_End: FocusEnd() \n\ - KP_Up: FocusPreviousGroup() \n\ - KP_Down: FocusNextGroup() \n\ + ": highlight() \n\ + : unhighlight() \n\ : set() start() \n\ : stop() unset() "; diff --git a/neXtaw/X11/neXtaw/Scrollbar.c b/neXtaw/X11/neXtaw/Scrollbar.c index e9d07be..b2971ee 100644 --- a/neXtaw/X11/neXtaw/Scrollbar.c +++ b/neXtaw/X11/neXtaw/Scrollbar.c @@ -63,7 +63,6 @@ SOFTWARE. #include "XawInit.h" #include "ScrollbarP.h" -#include "TraversalP.h" #include "Misc.h" #include @@ -80,27 +79,7 @@ static char defaultTranslations[] = : ScrollOneLineDown()\n\ Shift: ScrollPageUp()\n\ Shift: ScrollPageDown()\n\ - : EndScroll() \n\ - : FocusEnterWindow() \n\ - : FocusLeaveWindow() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() \n\ - Left: NotifyScroll(BackwardArrow) \n\ - Up: NotifyScroll(BackwardArrow) \n\ - Right: NotifyScroll(ForwardArrow) \n\ - Down: NotifyScroll(ForwardArrow) \n\ - Page_Up: NotifyScroll(BackwardPage) \n\ - Page_Down: NotifyScroll(ForwardPage) \n\ - Home: NotifyScroll(Home) \n\ - End: NotifyScroll(End) \n\ - KP_Left: NotifyScroll(BackwardArrow) \n\ - KP_Up: NotifyScroll(BackwardArrow) \n\ - KP_Right: NotifyScroll(ForwardArrow) \n\ - KP_Down: NotifyScroll(ForwardArrow) \n\ - KP_Page_Up: NotifyScroll(BackwardPage) \n\ - KP_Page_Down: NotifyScroll(ForwardPage) \n\ - KP_Home: NotifyScroll(Home) \n\ - KP_End: NotifyScroll(End) "; + : EndScroll()"; static float floatZero = 0.0; @@ -210,7 +189,7 @@ ScrollbarClassRec scrollbarClassRec = { /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, - /* accept_focus */ XawAcceptFocus, + /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ defaultTranslations, diff --git a/neXtaw/X11/neXtaw/Simple.c b/neXtaw/X11/neXtaw/Simple.c index 6bdbbf8..c52ba29 100644 --- a/neXtaw/X11/neXtaw/Simple.c +++ b/neXtaw/X11/neXtaw/Simple.c @@ -55,7 +55,6 @@ SOFTWARE. #include #include "XawInit.h" #include "SimpleP.h" -#include "TraversalP.h" #include #include "XawAlloc.h" @@ -78,20 +77,6 @@ static XtResource resources[] = { #undef offset }; -static XtActionsRec actionsList[] = { - {"FocusNext", XawFocusNextAction}, - {"FocusPrevious", XawFocusPreviousAction}, - {"FocusHome", XawFocusHomeAction}, - {"FocusEnd", XawFocusEndAction}, - {"FocusNextGroup", XawFocusNextGroupAction}, - {"FocusPreviousGroup", XawFocusPreviousGroupAction}, - {"FocusHomeGroup", XawFocusHomeGroupAction}, - {"FocusEndGroup", XawFocusEndGroupAction}, - {"FocusTake", XawFocusTakeAction}, - {"FocusEnterWindow", XawFocusEnterWindowAction}, - {"FocusLeaveWindow", XawFocusLeaveWindowAction} -}; - static void ClassPartInitialize(), ClassInitialize(),Realize(),ConvertCursor(); static Boolean SetValues(), ChangeSensitive(); @@ -106,8 +91,8 @@ SimpleClassRec simpleClassRec = { /* initialize */ NULL, /* initialize_hook */ NULL, /* realize */ Realize, - /* actions */ actionsList, - /* num_actions */ XtNumber(actionsList), + /* actions */ NULL, + /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, diff --git a/neXtaw/X11/neXtaw/Template.c b/neXtaw/X11/neXtaw/Template.c index 6a27d19..87807e8 100644 --- a/neXtaw/X11/neXtaw/Template.c +++ b/neXtaw/X11/neXtaw/Template.c @@ -30,7 +30,6 @@ in this Software without prior written authorization from the X Consortium. #include #include #include "TemplateP.h" -#include "TraversalP.h" static XtResource resources[] = { #define offset(field) XtOffsetOf(TemplateRec, template.field) @@ -50,20 +49,6 @@ static XtActionsRec actions[] = static char translations[] = ": template() \n\ - : FocusEnterWindow() \n\ - : FocusLeaveWindow() \n\ - : highlight() \n\ - : reset() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() \n\ - Home: FocusHome() \n\ - End: FocusEnd() \n\ - Up: FocusPreviousGroup() \n\ - Down: FocusNextGroup() \n\ - KP_Home: FocusHome() \n\ - KP_End: FocusEnd() \n\ - KP_Up: FocusPreviousGroup() \n\ - KP_Down: FocusNextGroup() \n\ "; TemplateClassRec templateClassRec = { @@ -93,7 +78,7 @@ TemplateClassRec templateClassRec = { /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, - /* accept_focus */ XawAcceptFocus, + /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ translations, diff --git a/neXtaw/X11/neXtaw/Text.c b/neXtaw/X11/neXtaw/Text.c index e1a11a6..a10e125 100644 --- a/neXtaw/X11/neXtaw/Text.c +++ b/neXtaw/X11/neXtaw/Text.c @@ -76,7 +76,6 @@ SOFTWARE. #include "TextP.h" #include "MultiSinkP.h" #include "XawImP.h" -#include "TraversalP.h" #include "ThreeDP.h" #include "Misc.h" @@ -3552,7 +3551,7 @@ TextClassRec textClassRec = { /* set_values_hook */ NULL, /* set_values_almost*/ XtInheritSetValuesAlmost, /* get_values_hook */ GetValuesHook, - /* accept_focus */ XawAcceptFocus, + /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* set in ClassInitialize */ diff --git a/neXtaw/X11/neXtaw/TextTr.c b/neXtaw/X11/neXtaw/TextTr.c index 282ce7f..57f41de 100644 --- a/neXtaw/X11/neXtaw/TextTr.c +++ b/neXtaw/X11/neXtaw/TextTr.c @@ -129,8 +129,8 @@ Ctrlbackslash: reconnect-im() \n\ "; char *_XawDefaultTextTranslations4 = "\ -: FocusEnterWindow() enter-window() \n\ -: FocusLeaveWindow() leave-window() \n\ +: enter-window() \n\ +: leave-window() \n\ : focus-in() \n\ : focus-out() \n\ : select-start() \n\ diff --git a/neXtaw/X11/neXtaw/Toggle.c b/neXtaw/X11/neXtaw/Toggle.c index c6215d2..234158e 100644 --- a/neXtaw/X11/neXtaw/Toggle.c +++ b/neXtaw/X11/neXtaw/Toggle.c @@ -48,7 +48,6 @@ in this Software without prior written authorization from the X Consortium. #include #include #include "ToggleP.h" -#include "TraversalP.h" #ifdef HAS_XMU_H #include #endif @@ -67,21 +66,9 @@ in this Software without prior written authorization from the X Consortium. */ static char defaultTranslations[] = - ": FocusEnterWindow() \n\ - : highlight(Always) \n\ - : FocusLeaveWindow() \n\ - : unhighlight() \n\ + ": highlight(Always) \n\ + : unhighlight() \n\ ,: toggle() notify() \n\ - ShiftTab: FocusPrevious() \n\ - Tab: FocusNext() \n\ - Home: FocusHome() \n\ - End: FocusEnd() \n\ - Up: FocusPreviousGroup() \n\ - Down: FocusNextGroup() \n\ - KP_Home: FocusHome() \n\ - KP_End: FocusEnd() \n\ - KP_Up: FocusPreviousGroup() \n\ - KP_Down: FocusNextGroup() \n\ space,space: toggle() notify()"; #define offset(field) XtOffsetOf(ToggleRec, field) diff --git a/neXtaw/X11/neXtaw/Traversal.c b/neXtaw/X11/neXtaw/Traversal.c deleted file mode 100644 index 6e55124..0000000 --- a/neXtaw/X11/neXtaw/Traversal.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * $Id: Traversal.c,v 1.2 2000/10/12 14:55:20 ulric Exp $ - */ - - -/* - -Copyright (c) 1999 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -*/ - -/* ___________________________________________________________________ - * /\ \ - * \_| This code implements keyboard traversal for the Athena widgets. | - * | ______________________________________________________________|_ - * \_/_______________________________________________________________/ - */ - - - - -#include -#include -#include -#include "TraversalP.h" -#include - - - -static XawFocusPolicy policy = XawFocusPointer ; - - -static Time getEventTime(XEvent *event) ; - - -static char focusTransTab[] = -" : XawFocusEnterWindow()\n" -" : XawFocusLeaveWindow()\n" -" ShiftTab: XawFocusPrevious()\n" -" Tab: XawFocusNext()\n" -" Home: XawFocusHome()\n" -" KP_Home: XawFocusHome()\n" -" End: XawFocusEnd()\n" -" KP_End: XawFocusEnd()\n" -" Up: XawFocusPreviousGroup()\n" -" KP_Up: XawFocusPreviousGroup()\n" -" Down: XawFocusNextGroup()\n" -" KP_Down: XawFocusNextGroup()\n"; -static XtTranslations focusTrans ; -static Bool focusInited = False ; - -static XtActionsRec focusActions[] = { - {"XawFocusNext", XawFocusNextAction}, - {"XawFocusPrevious", XawFocusPreviousAction}, - {"XawFocusHome", XawFocusHomeAction}, - {"XawFocusEnd", XawFocusEndAction}, - {"XawFocusNextGroup", XawFocusNextGroupAction}, - {"XawFocusPreviousGroup", XawFocusPreviousGroupAction}, - {"XawFocusHomeGroup", XawFocusHomeGroupAction}, - {"XawFocusEndGroup", XawFocusEndGroupAction}, - {"XawFocusTake", XawFocusTakeAction}, - {"XawFocusEnterWindow", XawFocusEnterWindowAction}, - {"XawFocusLeaveWindow", XawFocusLeaveWindowAction} -} ; - - - - -void -XawFocusInstallActions(XtAppContext ctx) -{ - XtAppAddActions(ctx, focusActions, XtNumber(focusActions)); -} - - - -void -XawFocusInstall(Widget w, Bool override) -{ - if( !focusInited ) { - focusTrans = XtParseTranslationTable(focusTransTab) ; - focusInited = True ; - } - if( override ) - XtOverrideTranslations(w, focusTrans) ; - else - XtAugmentTranslations(w, focusTrans) ; -} - - -static Bool -isViewable(dpy, w) - Display *dpy ; - Window w ; -{ - XWindowAttributes atts ; - - if( !XGetWindowAttributes(dpy, w, &atts) ) return False ; - else return atts.map_state == IsViewable ; -} - - -Boolean -XawAcceptFocus( Widget w, Time *tm ) -{ - /* To be eligible for keyboard focus, the widget must be - * realized, sensitive, managed, and be viewable. - */ - - /* Unfortunately, it requires a round trip to the server - * to find out if a window is viewable. - */ - - if( !w->core.being_destroyed && XtIsRealized(w) && - XtIsSensitive(w) && w->core.visible && XtIsManaged(w) && - isViewable(XtDisplay(w), XtWindow(w)) ) - { - XSetInputFocus(XtDisplay(w), XtWindow(w), RevertToParent, - tm != NULL ? *tm : CurrentTime ); - return True ; - } - else - return False ; -} - - -void -XawFocusNextAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusNext(w, tm) ; -} - - - -void -XawFocusPreviousAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusPrevious(w, tm) ; -} - - - -void -XawFocusHomeAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - (void) XawFocusHome(w, tm) ; -} - - - -void -XawFocusEndAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - (void) XawFocusEnd(w, tm) ; -} - - - -void -XawFocusNextGroupAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusNextGroup(w, tm) ; -} - - - -void -XawFocusPreviousGroupAction(Widget w, XEvent *event, - String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusPreviousGroup(w, tm) ; -} - - - -void -XawFocusHomeGroupAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusHomeGroup(w, tm) ; -} - - - -void -XawFocusEndGroupAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusEndGroup(w, tm) ; -} - - - -void -XawFocusTakeAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusTake(w, tm) ; -} - - - -void -XawFocusEnterWindowAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusEnterWindow(w, policy, tm) ; -} - - - -void -XawFocusLeaveWindowAction(Widget w, XEvent *event, String *params, Cardinal *np) -{ - Time tm = getEventTime(event) ; - - /* TODO: get policy from resources */ - - if( policy == XawFocusOld ) { - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm) ; - return ; - } - - XawFocusLeaveWindow(w, policy, tm) ; -} - - - /* end of the action procs */ - - - - -#define lastCh(w) ((w)->composite.num_children - 1) - -static Time -getEventTime(event) - XEvent *event ; -{ - Time tm = CurrentTime ; - - if( event != NULL ) { - switch( event->type ) { - case ButtonPress: - case ButtonRelease: tm = event->xbutton.time ; break ; - case KeyPress: - case KeyRelease: tm = event->xkey.time ; break ; - case MotionNotify: tm = event->xmotion.time ; break ; - case EnterNotify: - case LeaveNotify: tm = event->xcrossing.time ; break ; - } - } - - return tm ; -} - - - - - /* Utility: search for widget in it's parent's child list, - * return the index. - */ - -static int -findInParent(w) - Widget w ; -{ - CompositeWidget p = (CompositeWidget) XtParent(w) ; - int i ; - - if( p == NULL ) - return -1 ; - - for(i=0; i < p->composite.num_children; ++i) - if( p->composite.children[i] == w ) - return i ; - - return -1 ; -} - - - - - /* utility: search composite widget w, starting at c, for - * a child widget willing to accept input. Direction is - * either +1 or -1 for forward/backward search. - */ - - -static Bool -focusFind(w, c, recursive, direction, tm) - CompositeWidget w ; - int c ; - Bool recursive ; - int direction ; - Time tm ; -{ - int nc ; - Widget cw ; - - nc = w->composite.num_children ; - - while( c >= 0 && c < nc ) - { - cw = w->composite.children[c] ; - if( XtIsManaged(cw) ) - { - if( XtCallAcceptFocus(cw, &tm) ) - return True ; - if( recursive && XtIsComposite(cw) ) - { - CompositeWidget cwc = (CompositeWidget)cw ; - int c0 = direction > 0 ? 0 : lastCh(cwc) ; - if( focusFind(cwc, c0, recursive, direction, tm) ) - return True ; - } - } - c += direction ; - } - - return False ; /* nobody wanted it */ -} - - - - -void -XawFocusNext(w, tm) - Widget w ; - Time tm ; -{ - Widget p ; - int ci ; - - /* Search for the next widget after this one to - * receive input. If we encounter a composite widget, - * set focus to its first willing child, if any. If we - * reach the end, pop up a level and keep trying. If we - * can't pop up, go to the start. - */ - - /* First, see if this is a composite widget; test children. */ - - if( XtIsComposite(w) && - focusFind((CompositeWidget) w, 0, True, +1, tm) ) - return ; - - /* Nope. Start searching siblings. Easiest way to do this - * is to search parent. - */ - - while( (p = XtParent(w)) != NULL && !XtIsShell(p) ) - { - if( (ci = findInParent(w)) == -1 ) - return ; - - if( focusFind((CompositeWidget)p, ci+1, True, +1, tm) ) - return ; - - /* No luck there; pop up a level and try again */ - w = p ; - } - - /* Made it all the way to the top. Start from the beginning */ - XawFocusHome(w, tm) ; -} - - - /* Utility: search parents until a parent with multiple children - * is found. - */ - -static CompositeWidget -getMultiParent(w) - Widget w ; -{ - CompositeWidget p ; - while( (p = (CompositeWidget)XtParent(w)) != NULL && - !XtIsShell((Widget)p) && - p->composite.num_children == 1 ) - w = (Widget)p ; - return p ; -} - -void -XawFocusNextGroup(w, tm) - Widget w ; - Time tm ; -{ - CompositeWidget p = getMultiParent(w) ; - int ci ; - - /* search this widget's parent for another widget eligible - * to receive input. - * - * Actually, if the parent has only this one child, tabbing - * isn't very interesting, so we search up until we find - * a multi-child parent. - */ - - if( p == NULL ) - return ; - - if( (ci = findInParent(w)) != -1 ) - { - if( focusFind(p, ci+1, False, +1, tm) ) - return ; - if( focusFind(p, 0, False, +1, tm) ) - return ; - } - /* nobody wanted it, just return */ -} - - -void -XawFocusPrevious(w, tm) - Widget w ; - Time tm ; -{ - Widget p ; - int ci ; - - /* see focusNext() for detailed comments */ - - while( (p = XtParent(w)) != NULL && !XtIsShell(p) ) - { - if( (ci = findInParent(w)) == -1 ) return ; - if( focusFind((CompositeWidget)p, ci-1, True, -1, tm) ) return ; - w = (Widget)p ; - } - XawFocusEnd(w, tm) ; -} - -void -XawFocusPreviousGroup(w, tm) - Widget w ; - Time tm ; -{ - CompositeWidget p = getMultiParent(w) ; - int ci ; - - if( p == NULL ) return ; - - if( (ci = findInParent(w)) != -1 ) - { - if( focusFind(p, ci-1, False, -1, tm) ) return ; - if( focusFind(p, lastCh(p), False, -1, tm) ) return ; - } -} - -void -XawFocusHome(w, tm) - Widget w ; - Time tm ; -{ - Widget p ; - - /* Climb up to the top-level widget and then start - * searching from there. - */ - - while( (p = XtParent(w)) != NULL && !XtIsShell(p) ) - w = p ; - - (void) focusFind((CompositeWidget) w, 0, True, +1, tm) ; -} - -void -XawFocusHomeGroup(w, tm) - Widget w ; - Time tm ; -{ - CompositeWidget p = getMultiParent(w) ; - - if( p != NULL ) - (void) focusFind((CompositeWidget) p, 0, True, +1, tm) ; -} - -void -XawFocusEnd(w, tm) - Widget w ; - Time tm ; -{ - Widget p ; - - while( (p = XtParent(w)) != NULL && !XtIsShell(p) ) - w = p ; - - (void) focusFind((CompositeWidget) w, - lastCh(((CompositeWidget)w)), - True, -1, tm) ; -} - -void -XawFocusEndGroup(w, tm) - Widget w ; - Time tm ; -{ - CompositeWidget p = getMultiParent(w) ; - - if( p != NULL ) - (void) focusFind((CompositeWidget) w, - lastCh(((CompositeWidget)w)), - True, -1, tm) ; -} - -void -XawFocusTake(w, tm) - Widget w ; - Time tm ; -{ - (void) XtCallAcceptFocus(w, &tm) ; -} - -void -XawFocusEnterWindow(w, policy, tm) - Widget w ; - XawFocusPolicy policy ; - Time tm ; -{ - switch( policy ) { - case XawFocusExplicit: break ; - case XawFocusPointer: - case XawFocusOld: - XawFocusTake(w, tm) ; - break ; - } -} - -void -XawFocusLeaveWindow(w, policy, tm) - Widget w ; - XawFocusPolicy policy ; - Time tm ; -{ - Window current; - int revert; - XGetInputFocus(XtDisplay(w), ¤t, &revert); - if (XtWindow(w) != current) { - switch( policy ) { - case XawFocusExplicit: break ; - case XawFocusPointer: - case XawFocusOld: - XSetInputFocus(XtDisplay(w), PointerRoot, RevertToPointerRoot, tm); - break ; - } - } -} - diff --git a/neXtaw/X11/neXtaw/Traversal.h b/neXtaw/X11/neXtaw/Traversal.h deleted file mode 100644 index 7ac260d..0000000 --- a/neXtaw/X11/neXtaw/Traversal.h +++ /dev/null @@ -1,158 +0,0 @@ - -/* - -Copyright (c) 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -*/ - -#ifndef XawTraversal_h -#define XawTraversal_h - -#define XtNfocusPolicy "focusPolicy" -#define XtCFocusPolicy "FocusPolicy" - - -typedef enum { - XawFocusExplicit, /* focus changed only by keyboard or click */ - XawFocusPointer, /* focus also changed by pointer motion */ - XawFocusOld /* focus only changed by pointer motion */ - } XawFocusPolicy ; - - - /* This function allows non-Athena widgets to join the - * focus protocol. Call it once per application context. - */ - -extern void XawFocusInstallActions( -#if NeedFunctionPrototypes - XtAppContext -#endif -) ; - - /* This function can be called to help connect non-Athena widgets - * to the focus protocol. It installs new translations and - * actions into the target widget: - * - * : XawFocusEnterWindow() - * : XawFocusLeaveWindow() - * ShiftTab: XawFocusPrevious() - * Tab: XawFocusNext() - * Home: XawFocusHome() - * End: XawFocusEnd() - * Up: XawFocusPreviousGroup() - * Down: XawFocusNextGroup() - * KP_Home: XawFocusHome() - * KP_End: XawFocusEnd() - * KP_Up: XawFocusPreviousGroup() - * KP_Down: XawFocusNextGroup() - * - * Set 'override' to True to override translations, else False - * to augment. - * - * Note: this doesn't always do the whole job. Since this - * function overrides the and - * events, it may override actions you needed. If so, - * your application should follow this call with code to - * reset and to what you want. - * - * Note that XawFocusEnterWindow() and XawFocusLeaveWindow() - * will result in calls to and . - * - * Here is an example: Suppose widget Foo has this - * translation table: - * - * : highlight() - * : unhighlight() - * : highlight() - * : unhighlight() - * - * In this case, the and actions - * will be replaced with XawFocusEnterWindow(), XawFocusLeaveWindow(). - * These will result in calls to and which - * will do the right things. - * - * Suppose widget Foo has this translation table: - * - * : highlight() - * : unhighlight() - * - * A call to XawFocusInstall() will override these actions, - * causing your widget to no longer highlight properly. The - * best solution is to add and to Foo's - * translation table. - * - * Suppose Foo has this translation table: - * - * : highlight() start-animating() - * : unhighlight() stop-animating() - * : highlight() - * : unhighlight() - * - * The best solution here is to call XawOverrideTranslations() - * after XawFocusInstall(), and override with these translations: - * - * : XawFocusEnterWindow() start-animating() - * : XawFocusLeaveWindow() stop-animating() - * - */ - -extern void XawFocusInstall( -#if NeedFunctionPrototypes - Widget, Bool override -#endif -); - - - - /* These functions may be called to explicitly modify focus. */ - - -#if NeedFunctionPrototypes -extern void XawFocusNext(Widget w, Time tm) ; -extern void XawFocusNextGroup(Widget w, Time tm) ; -extern void XawFocusPrevious(Widget w, Time tm) ; -extern void XawFocusPreviousGroup(Widget w, Time tm) ; -extern void XawFocusHome(Widget w, Time tm) ; -extern void XawFocusHomeGroup(Widget w, Time tm) ; -extern void XawFocusEnd(Widget w, Time tm) ; -extern void XawFocusEndGroup(Widget w, Time tm) ; -extern void XawFocusTake(Widget w, Time tm) ; -extern void XawFocusEnterWindow(Widget w, XawFocusPolicy p, Time tm) ; -extern void XawFocusLeaveWindow(Widget w, XawFocusPolicy p, Time tm) ; -#else -extern void XawFocusNext() ; -extern void XawFocusNextGroup() ; -extern void XawFocusPrevious() ; -extern void XawFocusPreviousGroup() ; -extern void XawFocusHome() ; -extern void XawFocusHomeGroup() ; -extern void XawFocusEnd() ; -extern void XawFocusEndGroup() ; -extern void XawFocusTake() ; -extern void XawFocusEnterWindow() ; -extern void XawFocusLeaveWindow() ; -#endif - - -#endif /* XawTraversal_h */ diff --git a/neXtaw/X11/neXtaw/TraversalP.h b/neXtaw/X11/neXtaw/TraversalP.h deleted file mode 100644 index 3dd3346..0000000 --- a/neXtaw/X11/neXtaw/TraversalP.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * $Id: TraversalP.h,v 1.2 2000/10/12 14:55:20 ulric Exp $ - */ - -/* - -Copyright (c) 1999 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -*/ - -#ifndef XawTraversalP_h -#define XawTraversalP_h - -#include "Traversal.h" - - - - /* Class method which may be added to any widget class that - * will accept focus. Accepts focus any time the widget - * is sensitive and otherwise eligible. - */ - -extern Boolean XawAcceptFocus( -#if NeedFunctionPrototypes - Widget, Time * -#endif -); - - - - /* Action procedures which should be called by any class which - * wishes to participate in the keyboard traversal protocol. - * - * Procedures are: - * - * Next transfer focus to next eligible widget - * Previous transfer focus to previous eligible widget - * Home transfer focus to first eligible widget - * End transfer focus to last eligible widget - * Take transfer focus to this widget. - * NextGroup transfer focus to next in this local group - * PreviousGroup transfer focus to previous in this local group - * HomeGroup transfer focus to first in this local group - * EndGroup transfer focus to last in this local group - * EnterWindow react to enter-window - * LeaveWindow react to leave-window - * - * A "local group" is similar to the Motif "tab group". Local - * groups are all widgets under a single manager widget. Typically, - * arrow keys would navigate within a local group, whereas tab keys - * would navigate globally. - * - * If XawFocusPolicy is XawFocusPointer, this action proc ignores - * all keyboard traversal operations; thus creating the old - * behavior. - * - * Actions taken by EnterWindow and LeaveWindow depend on the - * XawFocusPolicy resource: - * XawFocusPointer: Sets focus window to PointerRoot - * XawFocusKey: Sets focus window to PointerRoot - * XawFocusSet: leaves focus unchanged. - */ - -extern void XawFocusNextAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusPreviousAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusHomeAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusEndAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusTakeAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusNextGroupAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusPreviousGroupAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusHomeGroupAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusEndGroupAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusEnterWindowAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - -extern void XawFocusLeaveWindowAction( -#if NeedFunctionPrototypes - Widget w, - XEvent *event, - String *params, - Cardinal *num_params -#endif -); - - - /* internal only; called by XawInitializeWidgetSet: */ - -extern void XawRegisterFocusConverter() ; - -#endif /* XawTraversalP_h */ diff --git a/neXtaw/X11/neXtaw/XawVersion.h b/neXtaw/X11/neXtaw/XawVersion.h index 79e4d60..17c6303 100644 --- a/neXtaw/X11/neXtaw/XawVersion.h +++ b/neXtaw/X11/neXtaw/XawVersion.h @@ -12,6 +12,5 @@ /* list features provided in this version */ #define XawM /* Athena Modern */ -#define XawTraversal /* keyboard traversal */ #endif /* Xaw3dVersion */ -- 1.7.0.4