1706f2543Smrg/* 2706f2543Smrg *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. 3706f2543Smrg * 4706f2543Smrg *Permission is hereby granted, free of charge, to any person obtaining 5706f2543Smrg * a copy of this software and associated documentation files (the 6706f2543Smrg *"Software"), to deal in the Software without restriction, including 7706f2543Smrg *without limitation the rights to use, copy, modify, merge, publish, 8706f2543Smrg *distribute, sublicense, and/or sell copies of the Software, and to 9706f2543Smrg *permit persons to whom the Software is furnished to do so, subject to 10706f2543Smrg *the following conditions: 11706f2543Smrg * 12706f2543Smrg *The above copyright notice and this permission notice shall be 13706f2543Smrg *included in all copies or substantial portions of the Software. 14706f2543Smrg * 15706f2543Smrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16706f2543Smrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17706f2543Smrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18706f2543Smrg *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR 19706f2543Smrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 20706f2543Smrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21706f2543Smrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22706f2543Smrg * 23706f2543Smrg *Except as contained in this notice, the name of Harold L Hunt II 24706f2543Smrg *shall not be used in advertising or otherwise to promote the sale, use 25706f2543Smrg *or other dealings in this Software without prior written authorization 26706f2543Smrg *from Harold L Hunt II. 27706f2543Smrg * 28706f2543Smrg * Authors: Harold L Hunt II 29706f2543Smrg */ 30706f2543Smrg 31706f2543Smrg#ifdef HAVE_XWIN_CONFIG_H 32706f2543Smrg#include <xwin-config.h> 33706f2543Smrg#endif 34706f2543Smrg#include "win.h" 35706f2543Smrg#include "winmsg.h" 36706f2543Smrg 37706f2543Smrg/* See Porting Layer Definition - p. 6 */ 38706f2543Smrgvoid 39706f2543SmrgwinBlockHandler (int nScreen, 40706f2543Smrg pointer pBlockData, 41706f2543Smrg pointer pTimeout, 42706f2543Smrg pointer pReadMask) 43706f2543Smrg{ 44706f2543Smrg#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) 45706f2543Smrg winScreenPriv((ScreenPtr)pBlockData); 46706f2543Smrg#endif 47706f2543Smrg MSG msg; 48706f2543Smrg#ifndef HAS_DEVWINDOWS 49706f2543Smrg struct timeval **tvp = pTimeout; 50706f2543Smrg if (*tvp != NULL) 51706f2543Smrg { 52706f2543Smrg (*tvp)->tv_sec = 0; 53706f2543Smrg (*tvp)->tv_usec = 100; 54706f2543Smrg } 55706f2543Smrg#endif 56706f2543Smrg 57706f2543Smrg#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) 58706f2543Smrg /* Signal threaded modules to begin */ 59706f2543Smrg if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) 60706f2543Smrg { 61706f2543Smrg int iReturn; 62706f2543Smrg 63706f2543Smrg winDebug ("winBlockHandler - Releasing pmServerStarted\n"); 64706f2543Smrg 65706f2543Smrg /* Flag that modules are to be started */ 66706f2543Smrg pScreenPriv->fServerStarted = TRUE; 67706f2543Smrg 68706f2543Smrg /* Unlock the mutex for threaded modules */ 69706f2543Smrg iReturn = pthread_mutex_unlock (&pScreenPriv->pmServerStarted); 70706f2543Smrg if (iReturn != 0) 71706f2543Smrg { 72706f2543Smrg ErrorF ("winBlockHandler - pthread_mutex_unlock () failed: %d\n", 73706f2543Smrg iReturn); 74706f2543Smrg goto winBlockHandler_ProcessMessages; 75706f2543Smrg } 76706f2543Smrg 77706f2543Smrg winDebug ("winBlockHandler - pthread_mutex_unlock () returned\n"); 78706f2543Smrg } 79706f2543Smrg 80706f2543SmrgwinBlockHandler_ProcessMessages: 81706f2543Smrg#endif 82706f2543Smrg 83706f2543Smrg /* Process all messages on our queue */ 84706f2543Smrg while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) 85706f2543Smrg { 86706f2543Smrg if ((g_hDlgDepthChange == 0 87706f2543Smrg || !IsDialogMessage (g_hDlgDepthChange, &msg)) 88706f2543Smrg && (g_hDlgExit == 0 89706f2543Smrg || !IsDialogMessage (g_hDlgExit, &msg)) 90706f2543Smrg && (g_hDlgAbout == 0 91706f2543Smrg || !IsDialogMessage (g_hDlgAbout, &msg))) 92706f2543Smrg { 93706f2543Smrg DispatchMessage (&msg); 94706f2543Smrg } 95706f2543Smrg } 96706f2543Smrg} 97