home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwplascr.zip / XWPL0208.ZIP / include / hook / hook_private.h next >
Text File  |  2002-08-10  |  14KB  |  352 lines

  1.  
  2. /*
  3.  * hook_private.h:
  4.  *      private declarations for the hook and the daemon.
  5.  *      These are not seen by XFLDR.DLL.
  6.  *
  7.  *@@include #define INCL_WINMESSAGEMGR
  8.  *@@include #include <os2.h>
  9.  *@@include #include xwphook.h
  10.  */
  11.  
  12. /*
  13.  *      Copyright (C) 1999-2002 Ulrich Möller.
  14.  *      This program is free software; you can redistribute it and/or modify
  15.  *      it under the terms of the GNU General Public License as published by
  16.  *      the Free Software Foundation, in version 2 as it comes in the COPYING
  17.  *      file of the XWorkplace main distribution.
  18.  *      This program is distributed in the hope that it will be useful,
  19.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  *      GNU General Public License for more details.
  22.  */
  23.  
  24. #ifndef HOOK_PRIVATE_HEADER_INCLUDED
  25.     #define HOOK_PRIVATE_HEADER_INCLUDED
  26.  
  27.     /* ******************************************************************
  28.      *
  29.      *   Shared mem/semaphore IDs
  30.      *
  31.      ********************************************************************/
  32.  
  33.     #define SHMEM_HOTKEYS         "\\SHAREMEM\\XWORKPLC\\HOTKEYS.DAT"
  34.     #define SHMEM_FUNCTIONKEYS    "\\SHAREMEM\\XWORKPLC\\FUNCKEYS.DAT"
  35.                 // added V0.9.3 (2000-04-20) [umoeller]
  36.  
  37.     #define IDMUTEX_ONEINSTANCE     "\\SEM32\\XWORKPLC\\ONEINST.MTX"
  38.     #define TIMEOUT_HMTX_HOTKEYS    6000
  39.  
  40.     // timer IDs for fnwpDaemonObject
  41. #ifndef __NOSLIDINGFOCUS__
  42.     #define TIMERID_SLIDINGFOCUS        1
  43. #endif
  44.     #define TIMERID_SLIDINGMENU         2
  45.     #define TIMERID_MONITORDRIVE        3
  46. #ifndef __NOMOVEMENT2FEATURES__
  47.     #define TIMERID_AUTOHIDEMOUSE       4
  48. #endif
  49.     #define TIMERID_AUTOSCROLL          5
  50. #ifndef __NOMOVEMENT2FEATURES__
  51.     #define TIMERID_MOVINGPTR           6
  52. #endif
  53.  
  54.     // timer IDs for pager
  55.     #define TIMERID_PGR_ACTIVECHANGED   7
  56.     #define TIMERID_PGR_FLASH           8
  57.     #define TIMERID_PGR_REFRESHDIRTIES  9
  58.  
  59.     /* ******************************************************************
  60.      *
  61.      *   Structures
  62.      *
  63.      ********************************************************************/
  64.  
  65.     /*
  66.      *@@ SCROLLDATA:
  67.      *      substructure for storing scroll data
  68.      *      for MB3-scroll processing. Two instances
  69.      *      of this exist in HOOKDATA, one for the
  70.      *      vertical, one for the horizontal scroll bar
  71.      *      of the window which was under the mouse when
  72.      *      MB3 was pressed down.
  73.      *
  74.      *@@added V0.9.2 (2000-02-25) [umoeller]
  75.      */
  76.  
  77.     typedef struct _SCROLLDATA
  78.     {
  79.         HWND        hwndScrollBar;
  80.                 // actual scroll bar window or NULLHANDLE if none
  81.         HWND        hwndScrollLastOwner;
  82.                 // WinQueryWindow(hwndScrollBar, QW_OWNER);
  83.                 // this gets recalculated with every mouse move
  84.                 // V0.9.3 (2000-04-30) [umoeller]
  85.  
  86.         // cached data used while MB3 is down; V0.9.1 (99-12-03)
  87.         // LONG        lScrollBarSize;
  88.                 // size (height or width) of the scroll bar (in window coordinates);
  89.                 // calculated when MB3 is depressed; the size of the buttons
  90.                 // has already been subtracted
  91.                 // V0.9.2 (2000-03-23) [umoeller]: removed this from SCROLLDATA
  92.                 // because this might change while the user holds down MB3, so this
  93.                 // needs to be recalculated with every WM_MOUSEMOVE
  94.         SHORT       sMB3InitialScreenMousePos,
  95.                 // mouse position when MB3 was depressed (in screen coordinates)
  96.                 // V0.9.3 (2000-04-30) [umoeller]: changed to screen
  97.                     sMB3InitialThumbPosUnits,
  98.                 // scroll bar thumb position when MB3 was depressed (in scroll bar units)
  99.                     sCurrentThumbPosUnits;
  100.                 // current scroll bar thumb position (in scroll bar units); this gets updated
  101.                 // when the mouse is moved while MB3 is depressed
  102.  
  103.         BOOL        fPostSBEndScroll;
  104.                 // this gets set to TRUE only if MB3 has been depressed and
  105.                 // the mouse has been moved and scroller messages have been
  106.                 // posted already;
  107.                 // this enforces a SB_ENDSCROLL when WM_BUTTON3UP comes
  108.                 // in later
  109.     } SCROLLDATA, *PSCROLLDATA;
  110.  
  111.     /*
  112.      *@@ HOOKDATA:
  113.      *      global hook data structure. Only one instance
  114.      *      of this is in the shared data segment of
  115.      *      XWPHOOK.DLL, and a pointer to that structure
  116.      *      is returned to the daemon which initially loads
  117.      *      that DLL by hookInit and then stored by the
  118.      *      daemon. As a result, this structure is shared
  119.      *      between the hook and the daemon, and both can
  120.      *      access it at any time.
  121.      *
  122.      *      This is statically initialized to 0 when the hook
  123.      *      DLL is loaded. hookInit will then set up most
  124.      *      fields in here.
  125.      *
  126.      *      This contains setup data (the state of the
  127.      *      hook), some data which needs to be cached,
  128.      *      as well as the HOOKCONFIG structure which
  129.      *      is used to configure the hook and the daemon.
  130.      *      That sub-structure gets (re)loaded from OS2.INI
  131.      *      upon daemon startup and when XDM_HOOKCONFIG is
  132.      *      received by fnwpDaemonObject.
  133.      */
  134.  
  135.     typedef struct _HOOKDATA
  136.     {
  137.         BOOL        fSendMsgHooked,     // send-message hook installed?
  138.                     fLockupHooked,      // lockup hook installed?
  139.                     fInputHooked,       // input hook installed?
  140.                     fPreAccelHooked;    // pre-accelerator table hook installed?
  141.  
  142.         HWND        hwndDaemonObject;
  143.                 // wnd used for notification of events;
  144.                 // this is the daemon object window
  145.                 // (fnwpDaemonObject) as passed to hookInit
  146.                 // and is the same as XWPGLOBALSHARED.hwndDaemonObject.
  147.                 // This receives lots of messages from the hook for
  148.                 // further processing.
  149.  
  150.         HAB         habDaemonObject;
  151.                 // anchor block of hwndDaemonObject; cached for speed
  152.  
  153.         HMODULE     hmodDLL;
  154.                 // XWPHOOK.DLL module handle
  155.  
  156.         // damon/hook configuration data shared by daemon and the hook;
  157.         // this gets loaded from OS2.INI
  158.         HOOKCONFIG  HookConfig;
  159.  
  160. #ifndef __NOPAGER__
  161.         // XPager configuration data shared by daemon and the hook;
  162.         // this gets loaded from OS2.INI also
  163.         PAGERCONFIG PagerConfig;
  164.  
  165.         PVOID       paEREs[MAX_STICKIES];
  166.                 // compiled regular expressions for every SF_MATCHES
  167.                 // that exists in PAGERCONFIG.aulStickyFlags;
  168.                 // WARNING: malloc'd by daemon, so this cannot be
  169.                 // used in the hook
  170.                 // V0.9.19 (2002-04-17) [umoeller]
  171.  
  172.         HWND        hwndPagerClient;
  173.                 // XPager client window, created by pgrCreatePager
  174.         HWND        hwndPagerFrame;
  175.                 // XPager frame window, created by pgrCreatePager
  176.         HWND        hwndPagerMoveThread;
  177.                 // XPager move thread (fnwpMoveThread)
  178.  
  179.         ULONG       cSuppressWinlistNotify;
  180.                 // if > 0, notification msgs from hook to pager
  181.                 // are disabled; this is set by pgrLockHook if
  182.                 // the pager itself is doing window positioning
  183.                 // to avoid infinite recursion
  184.                 // V0.9.19 (2002-05-07) [umoeller]
  185.         BOOL        fProcessingWraparound;
  186.                 // TRUE while processing a pager wraparound due
  187.                 // to hitting a screen border; we do not process
  188.                 // sliding focus then
  189.                 // added V0.9.9 (2001-03-14) [lafaix]
  190.                 // renamed V0.9.19 (2002-05-07) [umoeller]
  191.  
  192.         POINTL      ptlCurrentDesktop;
  193.                 // offset of current desktop in pixels
  194.         SIZEL       szlEachDesktopFaked;
  195.                 // size used for each virtual desktop; this is
  196.                 // the PM screen size plus a few extra pixels
  197.                 // to hide maximized window borders
  198. #endif
  199.  
  200.         HWND        hwndPMDesktop,
  201.                 // desktop window handle (WinQueryDesktopWindow)
  202.                     hwndWPSDesktop,
  203.                 // WPS desktop frame window (this only gets set by the daemon later!!)
  204.                     hwndSwitchList,
  205.                 // window list handle (frame)
  206.                     hwndSwitchListCnr;
  207.                 // window list's container
  208.         ULONG       pidPM,
  209.                 // process ID of first PMSHELL.EXE V0.9.7 (2001-01-21) [umoeller]
  210.                     pidWPS;
  211.                 // process ID of second PMSHELL.EXE V0.9.20 (2002-08-10) [umoeller]
  212.  
  213.         HWND        hwndLockupFrame;
  214.                 // current lockup window, if any
  215.  
  216.         // screen dimensions
  217.         // (we use LONG's because otherwise we'd have to typecast
  218.         // when calculating coordinates which might be off-screen;
  219.         // V0.9.2 (2000-02-23) [umoeller])
  220.         LONG        cxScreen,
  221.                     cyScreen;
  222.  
  223.         // and system icon size V0.9.19 (2002-06-13) [umoeller]
  224.         SIZEL       szlIcon;
  225.  
  226.         HWND        hwndActivatedByUs;
  227.                 // this gets set to a window which was activated by the
  228.                 // daemon with sliding focus
  229.  
  230.         // MB3 scrolling data; added V0.9.1 (99-12-03)
  231.         HWND        hwndCurrentlyScrolling;
  232.                 // this is != NULLHANDLE if MB3 has been depressed
  233.                 // over a window with scroll bars and reset to
  234.                 // NULLHANDLE once MB3 is released. This allows us
  235.                 // to simulate capturing the mouse without actually
  236.                 // capturing it, which isn't such a good idea in
  237.                 // a hook, apparently (changed V0.9.3 (2000-04-30) [umoeller])
  238.  
  239.         SCROLLDATA  SDXHorz,
  240.                     SDYVert;
  241.  
  242.         BOOL        bAutoScroll;
  243.                 // this is TRUE if auto scrolling has been requested.
  244.                 // Set by the hook, and used by XDM_BEGINSCROLL
  245.                 // V0.9.9 (2001-03-20) [lafaix]
  246.  
  247. #ifndef __NOMOVEMENT2FEATURES__
  248.         // auto-hide mouse pointer; added V0.9.1 (99-12-03)
  249.         ULONG       idAutoHideTimer;
  250.                 // if != NULL, auto-hide timer is running
  251.         BOOL        fMousePointerHidden;
  252.                 // TRUE if mouse pointer has been hidden
  253.         // auto-hide mouse pointer state backup; added V0.9.9 (2001-03-21) [lafaix]
  254.         BOOL        fOldAutoHideMouse;
  255. #endif
  256.  
  257.         // sliding menus
  258.         HWND        hwndMenuUnderMouse;
  259.         SHORT       sMenuItemIndexUnderMouse;
  260.                 // V0.9.12 (2001-05-24) [lafaix]: changed meaning (from identity to index)
  261.         MPARAM      mpDelayedSlidingMenuMp1;
  262.  
  263.         // click watches V0.9.14 (2001-08-21) [umoeller]
  264.         ULONG       cClickWatches,
  265.         // winlist watches V0.9.19 (2002-05-28) [umoeller]
  266.                     cWinlistWatches;
  267.  
  268.         // object hotkeys: if this flag is set, hotkeys are
  269.         // temporarily disabled; this gets set when the
  270.         // Hotkeys entry field on the "Icon" page gets the
  271.         // focus, via XDM_DISABLEHOTKEYSTEMP
  272.         // V0.9.16 (2001-12-08) [umoeller]
  273.         BOOL        fHotkeysDisabledTemp;
  274.  
  275.     } HOOKDATA, *PHOOKDATA;
  276.  
  277.     // special key for WM_MOUSEMOVE with delayed sliding menus
  278.     #define         HT_DELAYEDSLIDINGMENU   (HT_NORMAL+2)
  279.  
  280.     /* ******************************************************************
  281.      *
  282.      *   XPager definitions needed by the hook
  283.      *
  284.      ********************************************************************/
  285.  
  286. #ifndef __NOPAGER__
  287.     #define PGRM_POSITIONFRAME      (WM_USER + 301)
  288.     #define PGRM_REFRESHCLIENT      (WM_USER + 302)
  289.     #define PGRM_WINDOWCHANGE       (WM_USER + 303)
  290.     #define PGRM_ICONCHANGE         (WM_USER + 304)
  291.     #define PGRM_WRAPAROUND         (WM_USER + 305)
  292.     #define PGRM_PAGERHOTKEY        (WM_USER + 306)
  293.     #define PGRM_MOVEBYDELTA        (WM_USER + 307)
  294. #endif
  295.  
  296.     /* ******************************************************************
  297.      *
  298.      *   Hook DLL prototypes
  299.      *
  300.      ********************************************************************/
  301.  
  302.     PHOOKDATA EXPENTRY hookInit(HWND hwndDaemonObject);
  303.  
  304.     BOOL EXPENTRY hookKill(VOID);
  305.  
  306.     APIRET EXPENTRY hookSetGlobalHotkeys(PGLOBALHOTKEY pNewHotkeys,
  307.                                          ULONG cNewHotkeys,
  308.                                          PFUNCTIONKEY pNewFunctionKeys,
  309.                                          ULONG cNewFunctionKeys);
  310.  
  311.     /* ******************************************************************
  312.      *
  313.      *   Internal prototypes
  314.      *
  315.      ********************************************************************/
  316.  
  317.     VOID _Optlink StopMB3Scrolling(BOOL fSuccessPostMsgs);
  318.  
  319.     VOID _Optlink WMButton_SystemMenuContext(HWND hwnd);
  320.  
  321.     BOOL _Optlink WMMouseMove_MB3Scroll(HWND hwnd);
  322.  
  323.     BOOL _Optlink HandleMB3Msgs(PQMSG pqmsg,
  324.                                 PBOOL pfRestartAutoHide);
  325.  
  326.     HWND _Optlink GetFrameWindow(HWND hwndTemp);
  327.  
  328.     BOOL _Optlink WMMouseMove(PQMSG pqmsg,
  329.                               PBOOL pfRestartAutoHide);
  330.  
  331.     VOID _Optlink WMMouseMove_AutoHideMouse(VOID);
  332.  
  333.     BOOL _Optlink WMChar_Main(PQMSG pqmsg);
  334.  
  335.     extern HOOKDATA        G_HookData;
  336.     extern PGLOBALHOTKEY   G_paGlobalHotkeys;
  337.     extern ULONG           G_cGlobalHotkeys;
  338.     extern PFUNCTIONKEY    G_paFunctionKeys;
  339.     extern ULONG           G_cFunctionKeys;
  340.     extern HMTX            G_hmtxGlobalHotkeys;
  341.  
  342.     extern HWND    G_hwndUnderMouse;
  343.     extern HWND    G_hwndLastFrameUnderMouse;
  344.     extern HWND    G_hwndLastSubframeUnderMouse;
  345.     extern POINTS  G_ptsMousePosWin;
  346.     extern POINTL  G_ptlMousePosDesktop;
  347.     extern HWND    G_hwndRootMenu;
  348. #endif
  349.  
  350.  
  351.  
  352.