From 02a9d655ca44bb85fffc5b6185b70db04ca6e399 Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Fri, 1 Dec 2006 15:05:58 +0000 Subject: [PATCH] From Bertrand: cleanup obsolete WinNT files and remove some not needed anymore WinNT specifics from the TCint class. git-svn-id: http://root.cern.ch/svn/root/trunk@17018 27541ba8-7e3a-0410-8455-c3a389f83636 --- meta/inc/TCint.h | 3 +- meta/inc/TInterpreter.h | 8 +- meta/src/TCint.cxx | 17 +- win32gdk/inc/TGWin32InterpreterProxy.h | 3 +- winnt/Module.mk | 2 +- winnt/inc/LinkDef.h | 3 +- winnt/inc/TGWin32Command.h | 466 ------------------------- winnt/inc/TWin32Application.h | 69 ---- winnt/inc/TWin32HookViaThread.h | 42 --- winnt/inc/TWin32Semaphore.h | 29 -- winnt/inc/TWin32Timer.h | 48 --- winnt/inc/TWinNTInput.h | 55 --- winnt/inc/TWinNTSystem.h | 16 +- winnt/src/TGWin32Command.cxx | 74 ---- winnt/src/TWin32Application.cxx | 228 ------------ winnt/src/TWin32HookViaThread.cxx | 140 -------- winnt/src/TWin32Timer.cxx | 319 ----------------- winnt/src/TWinNTInput.cxx | 68 ---- winnt/src/TWinNTSystem.cxx | 161 +-------- 19 files changed, 9 insertions(+), 1742 deletions(-) delete mode 100644 winnt/inc/TGWin32Command.h delete mode 100644 winnt/inc/TWin32Application.h delete mode 100644 winnt/inc/TWin32HookViaThread.h delete mode 100644 winnt/inc/TWin32Semaphore.h delete mode 100644 winnt/inc/TWin32Timer.h delete mode 100644 winnt/inc/TWinNTInput.h delete mode 100644 winnt/src/TGWin32Command.cxx delete mode 100644 winnt/src/TWin32Application.cxx delete mode 100644 winnt/src/TWin32HookViaThread.cxx delete mode 100644 winnt/src/TWin32Timer.cxx delete mode 100644 winnt/src/TWinNTInput.cxx diff --git a/meta/inc/TCint.h b/meta/inc/TCint.h index 209faa37b9c..6554652fde9 100644 --- a/meta/inc/TCint.h +++ b/meta/inc/TCint.h @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TCint.h,v 1.28 2006/11/24 14:24:54 rdm Exp $ +// @(#)root/meta:$Name: $:$Id: TCint.h,v 1.29 2006/11/27 13:04:42 rdm Exp $ // Author: Fons Rademakers 01/03/96 /************************************************************************* @@ -70,7 +70,6 @@ protected: TCint(const TCint&); TCint& operator=(const TCint&); - virtual void ExecThreadCB(TWin32SendClass *command); virtual Int_t LoadLibraryMap(); public: diff --git a/meta/inc/TInterpreter.h b/meta/inc/TInterpreter.h index 6628a30b8a1..5a6bc52aed5 100644 --- a/meta/inc/TInterpreter.h +++ b/meta/inc/TInterpreter.h @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TInterpreter.h,v 1.24 2005/11/24 23:30:05 rdm Exp $ +// @(#)root/meta:$Name: $:$Id: TInterpreter.h,v 1.25 2006/11/27 13:04:42 rdm Exp $ // Author: Fons Rademakers 01/03/96 /************************************************************************* @@ -26,12 +26,6 @@ #include "TNamed.h" #endif -#ifdef WIN32 -# ifndef ROOT_TWin32HookViaThread -#include "TWin32HookViaThread.h" -# endif -#endif - class TClass; class TFunction; class TMethod; diff --git a/meta/src/TCint.cxx b/meta/src/TCint.cxx index 3e6c12354cd..7cc5f688d45 100644 --- a/meta/src/TCint.cxx +++ b/meta/src/TCint.cxx @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TCint.cxx,v 1.128 2006/11/27 13:04:42 rdm Exp $ +// @(#)root/meta:$Name: $:$Id: TCint.cxx,v 1.129 2006/11/30 23:19:47 pcanal Exp $ // Author: Fons Rademakers 01/03/96 /************************************************************************* @@ -42,13 +42,6 @@ #include "TEnv.h" #include "THashTable.h" -#ifdef R__WIN32 -# ifndef ROOT_TGWin32Command -# include "TGWin32Command.h" -# undef GetClassInfo -# endif -#endif - #include <vector> #include <string> using namespace std; @@ -219,14 +212,6 @@ void TCint::EndOfLineAction() ProcessLineSynch(fantomline); } -//______________________________________________________________________________ -void TCint::ExecThreadCB(TWin32SendClass *command) -{ - // This function must be called from the "Command thread only". - - if (command) { } -} - //______________________________________________________________________________ Bool_t TCint::IsLoaded(const char* filename) const { diff --git a/win32gdk/inc/TGWin32InterpreterProxy.h b/win32gdk/inc/TGWin32InterpreterProxy.h index 7f000291d40..07cc93fc739 100644 --- a/win32gdk/inc/TGWin32InterpreterProxy.h +++ b/win32gdk/inc/TGWin32InterpreterProxy.h @@ -1,4 +1,4 @@ -// $Id: TGWin32InterpreterProxy.h,v 1.12 2006/11/27 15:05:41 rdm Exp $ +// $Id: TGWin32InterpreterProxy.h,v 1.13 2006/11/27 15:42:38 rdm Exp $ // Author: Valeriy Onuchin 15/11/03 /************************************************************************* @@ -78,7 +78,6 @@ public: Bool_t SetErrorMessages(Bool_t enable = kTRUE); Bool_t IsProcessLineLocked() const { return RealObject()->IsProcessLineLocked(); } void SetProcessLineLock(Bool_t lock = kTRUE); - void ExecThreadCB(TWin32SendClass *) {} Int_t GetExitCode() const { return RealObject()->GetExitCode(); } Int_t GetMore() const { return RealObject()->GetMore(); } Bool_t IsLoaded(const char *filename) const { return RealObject()->IsLoaded(filename); } diff --git a/winnt/Module.mk b/winnt/Module.mk index 2f19e974a16..869903ff8eb 100644 --- a/winnt/Module.mk +++ b/winnt/Module.mk @@ -17,7 +17,7 @@ WINNTDS := $(MODDIRS)/G__WinNT.cxx WINNTDO := $(WINNTDS:.cxx=.o) WINNTDH := $(WINNTDS:.cxx=.h) -WINNTH1 := $(MODDIRI)/TWinNTSystem.h $(MODDIRI)/TWinNTInput.h +WINNTH1 := $(MODDIRI)/TWinNTSystem.h WINNTH := $(filter-out $(MODDIRI)/LinkDef%,$(wildcard $(MODDIRI)/*.h)) WINNTS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) WINNTO := $(WINNTS:.cxx=.o) diff --git a/winnt/inc/LinkDef.h b/winnt/inc/LinkDef.h index 1d423cad873..9d7ebca5bbb 100644 --- a/winnt/inc/LinkDef.h +++ b/winnt/inc/LinkDef.h @@ -1,4 +1,4 @@ -/* @(#)root/winnt:$Name$:$Id$ */ +/* @(#)root/winnt:$Name: $:$Id: LinkDef.h,v 1.1.1.1 2000/05/16 17:00:46 rdm Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * @@ -15,6 +15,5 @@ #pragma link off all functions; #pragma link C++ class TWinNTSystem; -#pragma link C++ class TWinNTInput; #endif diff --git a/winnt/inc/TGWin32Command.h b/winnt/inc/TGWin32Command.h deleted file mode 100644 index 1d2b49b9dec..00000000000 --- a/winnt/inc/TGWin32Command.h +++ /dev/null @@ -1,466 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Valery Fine 23/01/96 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_TGWin32Command -#define ROOT_TGWin32Command - -#ifndef ROOT_TVirtualX -#include "TVirtualX.h" -#endif - -#include "Windows4Root.h" - -#ifndef ROOT_Win32Constants -#include "Win32Constants.h" -#endif - -#ifndef ROOT_TWin32Semaphore -#include "TWin32Semaphore.h" -#endif - -class TGWin32Object; - -//______________________________________________________________________________ -class TGWin32Command { - -private: - int fMasterFlag; // Command suits the master object only - int fCodeOP; // Code of the opertation - int fBuffered; // Command does sense "Double biffer" mode - UINT fMessageID; // ID of the windows message to perform this command; - -public: - TGWin32Command(int code, int type=ROOT_Primitive,int master=0); - void SetMsgID(UINT uMsg=IX11_ROOT_MSG){fMessageID = uMsg;} - virtual void SetCOP(int code); - virtual int GetCOP(); - UINT GetMsgID(){ return fMessageID; } - void SetBuffered(int buffered=1){fBuffered=buffered;} - int GetBuffered(){ return fBuffered;} -}; - -//______________________________________________________________________________ -class TGWin32GLCommand : public TWin32Semaphore, public TGWin32Command -{ - -public: - TGWin32GLCommand(int code=GL_MAKECURRENT) : TGWin32Command(code,ROOT_OpenGL){;} -}; - -//______________________________________________________________________________ -class TGWin32Box : public TGWin32Command { - -private: - - int fX1; // Coordinate of the corners of the box to draw - int fY1; - int fX2; - int fY2; - int fMode; - -public: - - TGWin32Box(int x1, int y1, int x2, int y2, TVirtualX::EBoxMode mode,int code=IX_BOX) : TGWin32Command(code){ - fX1 = min(x1,x2); - fX2 = max(x1,x2); - fY1 = min(y1,y2); - fY2 = max(y1,y2); - fMode = (int) mode; - } - - int GetX1(){return fX1;} - int GetY1(){return fY1;} - int GetX2(){return fX2;} - int GetY2(){return fY2;} - int GetMode(){return fMode;} -}; - -//______________________________________________________________________________ -class TGWin32SetDoubleBuffer : public TGWin32Command { -//*-*-*-*-*-*-*-*-*-*-*-*TGWin32DoubleBuffer*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* This class changes the Double buffer mode of the affected window -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -private: - int fDoubleBuffer; -public: - TGWin32SetDoubleBuffer(int doublebuf=1,int code=IX_SETBUF):TGWin32Command(code,ROOT_Control) - {fDoubleBuffer = doublebuf; SetBuffered(0);} - int GetBuffer(){ return fDoubleBuffer;} -}; - -//______________________________________________________________________________ -class TGWin32GetDoubleBuffer : public TWin32Semaphore, public TGWin32Command { -//*-*-*-*-*-*-*-*-*-*-*-*TGWin32DoubleBuffer*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* This class tests the Double buffer mode of the affected window -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -private: - int fDoubleBuffer; -public: - TGWin32GetDoubleBuffer(int code=IX_GETBUF):TGWin32Command(code,ROOT_Control) {SetBuffered(0);;} - int GetBuffer(){ return fDoubleBuffer;} - void SetBuffer(int mode){fDoubleBuffer = mode;} -}; - -//______________________________________________________________________________ -class TGWin32Cell : public TGWin32Command { - -private: - - int fX1; // Coordinate of the corners of the box to draw - int fY1; - int fX2; - int fY2; - int fNx; // Number of cell along X - int fNy; // Number of cell along Y - int *fCellArray; // Array of the cells to draw - -public: - - TGWin32Cell(int x1, int y1, int x2, int y2, int nx, int ny, int *cells,int code=IX_CA) : TGWin32Command(code){ - fX1 = x1; - fX2 = x2; - fY1 = y1; - fY2 = y2; - fNx = nx; - fNy = ny; - fCellArray = cells; - } - - int GetX1(){return fX1;} - int GetY1(){return fY1;} - int GetX2(){return fX2;} - int GetY2(){return fY2;} - int GetNx(){return fNx;} - int GetNy(){return fNy;} - int *GetCells(){return fCellArray;} -}; - -//______________________________________________________________________________ -class TGWin32Clear : public TGWin32Command { - -public: - TGWin32Clear(int code=IX_CLRWI) : TGWin32Command(code,ROOT_Control){ ; } -}; - -//______________________________________________________________________________ -class TGWin32Clip : public TGWin32Command { - - RECT fRegion; // The rectangle area to clip Win object - -public: - TGWin32Clip(int w = 0, int h = 0, int x = 0, int y =0, int code=IX_CLIP) : TGWin32Command(code,ROOT_Control){ - fRegion.left = x; - fRegion.top = y; - fRegion.right = x+w; - fRegion.bottom = y+h; - } -}; - -//______________________________________________________________________________ -class TGWin32CopyTo : public TGWin32Command { - -private: - - TGWin32Object *fSourceWinObject; // Poiter to the Win object where this will be copied to - POINT fPointFrom; // List of the nodes - POINT fPointTo; // List of the nodes - -public: - - TGWin32CopyTo(TGWin32Object *, int xpost, int ypost, int xposf, int yposf, int code=IX_CPPX); - - TGWin32Object *GetSource(); - POINT *GetPointsFrom(); - POINT *GetPointsTo(); -}; - -//______________________________________________________________________________ -class TGWin32CreateStatusBar : public TWin32Semaphore, public TGWin32Command { -//*-*-*-*-*-*-*-*-*-*-*-*TGWin32CreateStatusBar-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* This class creates a child WIN32 status window -//*-* It returns the HWND handle of the child status window -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -private: - HWND fhwndWindow ; -public: - TGWin32CreateStatusBar(int code=IX_SETSTATUS):TGWin32Command(code,ROOT_Control) {SetBuffered(0);} - HWND GetWindow(){ return fhwndWindow;} - void SetWindow(HWND hwnd){fhwndWindow = hwnd;} -}; - -//______________________________________________________________________________ -class TGWin32UpdateWindow : public TGWin32CopyTo { -public: - TGWin32UpdateWindow(int code=IX_UPDWI) : - TGWin32CopyTo(0,0,0,0,0,code){SetBuffered(0);} -}; -//______________________________________________________________________________ -class TGWin32DrawMode : public TGWin32Command { - - -private: - int fMode; -public: - TGWin32DrawMode(TVirtualX::EDrawMode mode, int code=IX_DRMDE) : TGWin32Command(code,ROOT_Attribute){ - fMode = Win32DrawMode[mode-1]; - } - int GetMode(){return fMode;} -}; - -//______________________________________________________________________________ -class TGWin32DrawPolyLine : public TGWin32Command { - -private: - int fNum; // Number of the nodes in the polylines (=1 means just a single pixel) - POINT *flpPoint; // A position inside of the destination object to copy this - -public: - TGWin32DrawPolyLine(int n, POINT *lpp, int code=IX_LINE); - int GetNumber(); - POINT *GetPoints(); -}; - - -//______________________________________________________________________________ -class TGWin32DrawText : public TGWin32Command { - -//*-*-*-*-*-*-*-*-*-*-*Draw a text string using current font*-*-*-*-*-*-*-*-*-* -//*-* ===================================== -//*-* mode : drawing mode -//*-* mode=0 : the background is not drawn (kClear) -//*-* mode=1 : the background is drawn (kSolid) -//*-* x,y : text position -//*-* angle : text angle -//*-* mgn : magnification factor -//*-* text : text string -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - -private: - - int fX; // Text position; - int fY; - const char *fText; // text string - TVirtualX::ETextMode fMode; // Draw mode - -public: - - TGWin32DrawText(int x, int y, const char *text, TVirtualX::ETextMode mode=TVirtualX::kClear, int code=IX_TEXT) - : TGWin32Command(code,ROOT_Text) - { - fX = x; - fY = y; - fText = text; - fMode = mode; - } - - int GetX(){return fX;} - int GetY(){return fY;} - void SetSize(SIZE *lpSize){fX = lpSize->cx;fY = lpSize->cy;} - TVirtualX::ETextMode GetMode(){ return fMode;} - - const char *GetText(){return fText;} -}; - -//______________________________________________________________________________ -class TGWin32GetColor : public TGWin32Command { - -private: - - int fCindex; // Color index - PALETTEENTRY fPalette; // Palette entry data structure - -public: - - TGWin32GetColor(int ci, int code=IX_GETCOL) : TGWin32Command(code,ROOT_Inquiry){fCindex = ci;} - PALETTEENTRY *GetPalPointer(){return &fPalette;} - int GetCIndex(){return fCindex;} - int Red(){return (int) fPalette.peRed;} - int Green(){return (int) fPalette.peGreen;} - int Blue(){return (int) fPalette.peBlue;} - - -}; - -//______________________________________________________________________________ -class TGWin32GetLocator : public TWin32Semaphore, public TGWin32Command { - -private: - - LONG fX; // x cursor position (initial and queried) - LONG fY; // y cursor postion - int fType ; // shape of the cursor: - // =1 tracking cross - // =2 cross-hair - // =3 rubber circle - // =4 rubber band - // =5 rubber rectangle - - int fButton; // Number of the pressed button - int fMode; // Input mode: - // =0 request - // =1 sample - -public: - - TGWin32GetLocator(int x, int y, int ctyp, int mode, int code = IX_REQLO) : TGWin32Command(code,ROOT_Input){ - fX = x; - fY = y; - fType = ctyp; - fMode = mode; - } - - int GetX(){return fX;} - int GetY(){return fY;} - int GetButton(){return fButton;} - int GetMode(){return fMode;} - int GetType(){return fType;} - void SetXY(POINT *xy){ fX = xy->x; fY = xy->y;} - void SetButton(int button){ fButton = button;} - -}; - -//______________________________________________________________________________ -class TGWin32GetString : public TWin32Semaphore, public TGWin32Command { - -private: - - LONG fX; // x cursor position (initial and queried) - LONG fY; // y cursor postion - Int_t fBreakKey; // Flag to mark whether user did inter line or cancel input - const Text_t *fText; // Text buffer to transfer init value and accept result - - -public: - - TGWin32GetString(int x, int y, const Text_t *string, int code = IX_REQST) : TGWin32Command(code,ROOT_Input){ - fX = x; - fY = y; - fBreakKey = -1; - fText = string; - } - - int GetX(){return fX;} - int GetY(){return fY;} - Int_t GetBreakKey(){ return fBreakKey;} - const Text_t *GetTextPointer(){ return fText;} - void IncBreakKey(){ fBreakKey++;} - void SetXY(POINT *xy){ fX = xy->x; fY = xy->y;} -}; - -class TContextMenu; -class TMethod; - -//______________________________________________________________________________ -class TGWin32MenuExecute : public TGWin32Command { - - -private: - - TObject *fObject; - TMethod *fMethod; - TContextMenu *fContextMenu; - char *fParams; - -public: - - TGWin32MenuExecute(TObject *o, TMethod *m, TContextMenu *menu, char *params, int code = 0) : TGWin32Command(code,0) { - fObject = o; - fMethod = m; - fContextMenu = menu; - fParams = 0; - if (params) {fParams = new char[strlen(params)+1]; strcpy(fParams,params);} - } - ~TGWin32MenuExecute() { if (fParams) delete [] fParams; fParams = 0;} - TContextMenu *GetContextMenu(){return fContextMenu;} - char *GetMenuParams(){return fParams;} - TObject *GetMenuObject(){return fObject;} - TMethod *GetMenuMethod(){return fMethod;} -}; - -//______________________________________________________________________________ -class TGWin32AddMenu: public TGWin32Command { - -private: - - HMENU fMenu; // Menu handle to set - -public: - TGWin32AddMenu(HMENU menu, int code = IX_SETMENU): TGWin32Command(code,ROOT_Attribute) {fMenu = menu;} - HMENU GetMenuHandle(){ return fMenu;} -}; - - -class TWin32Dialog; -//______________________________________________________________________________ -class TWin32AddDialog : public TGWin32Command { - -private: - - TWin32Dialog *fDialog; // pointer to the dialog to add - Int_t fType; // type of the dialog to add - -public: - - TWin32AddDialog(TWin32Dialog *dialog,int code = 0) : TGWin32Command(code,0){fDialog=dialog;} - ~TWin32AddDialog(){;} - TWin32Dialog *GetDialog(){return fDialog;} - Int_t GetDialogType(){ return fType;} -}; - -//______________________________________________________________________________ -class TWin32SendClass : public TGWin32Command { -private: - void *fPointer; - UInt_t fMessageData[4]; - -public: - - TWin32SendClass(void *sentclass, int code=kSendClass) : TGWin32Command(code,0) - { - fPointer = sentclass; - SetMsgID(ROOT_CMD); - fMessageData[0] = 0; - fMessageData[1] = 0; - fMessageData[2] = 0; - fMessageData[3] = 0; - } - - TWin32SendClass(void *sentclass, UInt_t hwnd, UInt_t message, UInt_t wParam, UInt_t lParam, int code=kSendClass) : TGWin32Command(code,0) - { - fPointer = sentclass; - SetMsgID(ROOT_CMD); - fMessageData[0] = hwnd; - fMessageData[1] = message; - fMessageData[2] = wParam; - fMessageData[3] = lParam; - } - - virtual void *GetPointer(){ return fPointer;} - virtual UInt_t GetData(Int_t i){ return (i >= 0 && i <4) ? fMessageData[i] : 0;} - -}; - -//______________________________________________________________________________ -class TWin32SendWaitClass : public TWin32SendClass { - -private: - TWin32Semaphore fSemaphore; - -public: - TWin32SendWaitClass(void *sentclass, int code=kSendWaitClass) :TWin32SendClass(sentclass,code){ ; } - - TWin32SendWaitClass(void *sentclass, UInt_t hwnd, UInt_t message, UInt_t wParam, UInt_t lParam, int code=kSendWaitClass): - TWin32SendClass(sentclass, hwnd, message, wParam, lParam, code){ ; } - void Wait() { fSemaphore.Wait(); } - void Release(){ fSemaphore.Release(); } - -}; - -#endif diff --git a/winnt/inc/TWin32Application.h b/winnt/inc/TWin32Application.h deleted file mode 100644 index 97ca8431fd6..00000000000 --- a/winnt/inc/TWin32Application.h +++ /dev/null @@ -1,69 +0,0 @@ -// @(#)root/winnt:$Name: $:$Id: TWin32Application.h,v 1.4 2001/10/02 09:07:43 rdm Exp $ -// Author: Valery Fine 10/01/96 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TWin32Application -#define ROOT_TWin32Application - -////////////////////////////////////////////////////////////////////////// -// // -// TGWin32 // -// // -// Interface to low level Windows32. This class gives access to basic // -// Win32 graphics, pixmap, text and font handling routines. // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_TApplicationImp -#include "TApplicationImp.h" -#endif - -#include "Windows4Root.h" -#include <commctrl.h> - -class TGWin32Command; - -#ifdef _SC_ -LPTHREAD_START_ROUTINE ROOT_CmdLoop(HANDLE ThrSem); -#else -unsigned int _stdcall ROOT_CmdLoop(HANDLE ThrSem); -#endif - -class TWin32Application : public TApplicationImp { - -private: - - DWORD fIDCmdThread; - HANDLE fhdCmdThread; - - Int_t CreateCmdThread(); - -public: - - TWin32Application() {}; - TWin32Application(const char *appClassName, int *argc, char **argv); - virtual ~TWin32Application(); - - BOOL ExecCommand(TGWin32Command *command, Bool_t synch=kFALSE); // To exec a command coming from the other threads - DWORD GetCmdThreadID(){return fIDCmdThread;} - void Show(); - void Hide(); - void Iconify(); - Bool_t IsCmdThread(); - void Init(); - void Open(); - void Raise(); - void Lower(); - - // ClassDef(TWin32Application,0) - -}; - -#endif diff --git a/winnt/inc/TWin32HookViaThread.h b/winnt/inc/TWin32HookViaThread.h deleted file mode 100644 index eb9e26abb7a..00000000000 --- a/winnt/inc/TWin32HookViaThread.h +++ /dev/null @@ -1,42 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Valery Fine(fine@vxcern.cern.ch) 31/07/96 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -// This class is used to synchonize threads -// To implement event the base class should never call his own callback -// function directly rather via thread hook. - -#ifndef ROOT_TWin32HookViaThread -#define ROOT_TWin32HookViaThread - -#ifndef ROOT_RTypes -#include "Rtypes.h" -#endif - -class TGWin32Command; -class TWin32SendClass; -class TWin32SendWaitClass; - -class TWin32HookViaThread { - -protected: - int fSendFlag; // = 0 - No message - // 1 - Message is about to be sent - // 2 - Message is about to be destroyed - -public: - TWin32HookViaThread(){;} // default ctor - virtual void ExecCommandThread(TGWin32Command *command=0, Bool_t synch=kTRUE); // Pass the command to the altrenative "command" thread - virtual void ExecWindowThread(TGWin32Command *command=0); // Pass the command to the altrenative "window" thread - virtual void ExecThreadCB(TWin32SendClass *command=0) = 0; // Perform the command - virtual void ExecThreadCB(TWin32SendWaitClass *command=0){;} // Perform the command then release the origin thread - static Bool_t ExecuteEvent(void *msg,Bool_t synch=kTRUE,UInt_t msgtype=UInt_t(-1)); // Indirect call ExecThreadCB method -}; - -#endif diff --git a/winnt/inc/TWin32Semaphore.h b/winnt/inc/TWin32Semaphore.h deleted file mode 100644 index da132939bff..00000000000 --- a/winnt/inc/TWin32Semaphore.h +++ /dev/null @@ -1,29 +0,0 @@ -/* @(#)root/winnt:$Name: $:$Id: TWin32Semaphore.h,v 1.1.1.1 2000/05/16 17:00:47 rdm Exp $ */ - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TWin32Semaphore -#define ROOT_TWin32Semaphore - -#include <Windows4Root.h> - -class TWin32Semaphore { - -private: - HANDLE fSemaphore; // Handle of the semaphore to synch actitvities - -public: - TWin32Semaphore(){fSemaphore = CreateSemaphore(NULL, 0, 1, NULL);} - virtual ~TWin32Semaphore(){ CloseHandle(fSemaphore); } - virtual void Wait() {WaitForSingleObject(fSemaphore, INFINITE);} - virtual void Release(){ReleaseSemaphore(fSemaphore,1L,NULL); } -}; - - -#endif diff --git a/winnt/inc/TWin32Timer.h b/winnt/inc/TWin32Timer.h deleted file mode 100644 index e1ef6c431d5..00000000000 --- a/winnt/inc/TWin32Timer.h +++ /dev/null @@ -1,48 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Valery Fine(fine@mail.cern.ch) 29/09/98 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_TWin32Timer -#define ROOT_TWin32Timer - -#include "TWin32HookViaThread.h" - -class TTimer; - -class TWin32Timer : protected TWin32HookViaThread -{ - - private: - ULong_t *fhdTimerThread; - HWND fhdTimerWindow; - DWORD fhdTimerThreadId; - - protected: - virtual void ExecThreadCB(TWin32SendClass *command); - void SetTimerThread(ULong_t *handle){fhdTimerThread = handle;} - Int_t CreateTimerThread(); - void CreateTimerCB(TTimer *timer); - void KillTimerCB(TTimer *timer); - void ExecTimerThread(TGWin32Command *command); - - public: - TWin32Timer(); - virtual ~TWin32Timer(); - UInt_t CreateTimer(TTimer *timer); - void SetHWND(HWND hwnd){fhdTimerWindow = hwnd;} - HWND GetHwnd(){ return fhdTimerWindow;} - void Reset(ULong_t newtime=0); - void Delete(){;} - void Create(){;} - Bool_t ExecCommand(TGWin32Command *command,Bool_t synch=kTRUE); - Bool_t IsTimeThread(); - void KillTimer(TTimer *timer); -}; - -#endif diff --git a/winnt/inc/TWinNTInput.h b/winnt/inc/TWinNTInput.h deleted file mode 100644 index 96ce77cde7c..00000000000 --- a/winnt/inc/TWinNTInput.h +++ /dev/null @@ -1,55 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Fons Rademakers 02/04/95 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef CodeROOT_TWinNTInput -#define CodeROOT_TWinNTInput - - -////////////////////////////////////////////////////////////////////////// -// // -// TWinNTInput // -// // -// This class encapsulates input callback from file descriptors. // -// // -////////////////////////////////////////////////////////////////////////// - -#if !defined(__CINT__) -#include <windows.h> -#endif - -#ifndef ROOT_Rtypes -#include "Rtypes.h" -#endif - - -class TWinNTInput { - -private: - - static void InputHandler(void *clientData, int *source, void *id); - -protected: - - int fFd; - - public: - - TWinNTInput(); - ~TWinNTInput(); - void Attach(int fd, int mask); - void Remove(); - int Fd(); - int Id(); - - ClassDef(TWinNTInput,0) //Handle callbacks from file descriptors -}; - -#endif diff --git a/winnt/inc/TWinNTSystem.h b/winnt/inc/TWinNTSystem.h index e309629e5d0..d7b72c392b9 100644 --- a/winnt/inc/TWinNTSystem.h +++ b/winnt/inc/TWinNTSystem.h @@ -1,4 +1,4 @@ -// @(#)root/winnt:$Name: $:$Id: TWinNTSystem.h,v 1.43 2006/11/05 23:58:46 rdm Exp $ +// @(#)root/winnt:$Name: $:$Id: TWinNTSystem.h,v 1.44 2006/11/15 18:27:17 rdm Exp $ // Author: Fons Rademakers 15/09/95 /************************************************************************* @@ -66,8 +66,6 @@ struct group { }; -class TWin32Timer; - class TWinNTSystem : public TSystem { private: @@ -79,15 +77,9 @@ private: Bool_t fGroupsInitDone; // Flag used for Users and Groups initialization HANDLE fhProcess; // Handle of the current process - HANDLE fhTermInputEvent; // Handle of "event" to suspend "dummy" terminal loop char *fDirNameBuffer; // The string buffer to hold path name WIN32_FIND_DATA fFindFileData; // Structure to look for files (aka OpenDir under UNIX) - TWin32Timer *fWin32Timer; // Windows -asynch timer - HIMAGELIST fhSmallIconList; // List of the small icons - HIMAGELIST fhNormalIconList; // List of the normal icons - const char *fShellName; // The name of the "shell" file to pool the icons - void CreateIcons(); // Create a list of the icons for ROOT appl Bool_t DispatchTimers(Bool_t mode); Bool_t CheckDescriptors(); Bool_t CheckSignals(Bool_t sync); @@ -108,13 +100,7 @@ public: virtual ~TWinNTSystem(); //---- non-TSystem methods ---------------------------------- - HIMAGELIST GetSmallIconList() { return fhSmallIconList; } - HICON GetSmallIcon(Int_t IconIdx) { return fhSmallIconList ? ImageList_GetIcon(fhSmallIconList,IconIdx,ILD_NORMAL):0; } - HICON GetNormalIcon(Int_t IconIdx){ return fhNormalIconList ? ImageList_GetIcon(fhNormalIconList,IconIdx,ILD_NORMAL):0; } - HIMAGELIST GetNormalIconList(){ return fhNormalIconList; } HANDLE GetProcess(); - const char *GetShellName() {return fShellName;} - void SetShellName(const char *name=0); Bool_t HandleConsoleEvent(); //---- Misc ------------------------------------------------- diff --git a/winnt/src/TGWin32Command.cxx b/winnt/src/TGWin32Command.cxx deleted file mode 100644 index ea4354aa05b..00000000000 --- a/winnt/src/TGWin32Command.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Valery Fine 23/01/96 - -#include "TGWin32Command.h" - -//______________________________________________________________________________ - TGWin32Command::TGWin32Command(int code, int type, int master){ - fMasterFlag = master; - fCodeOP = MAKEWPARAM(code,type); - fBuffered = 1; // by default all commands can be buffered - SetMsgID(); - } -//______________________________________________________________________________ - void TGWin32Command::SetCOP(int code){ fCodeOP = code;} -//______________________________________________________________________________ - int TGWin32Command::GetCOP(){return fCodeOP;} - -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- -//*-* -//*-* Here is a set of the special messages to control WIN32 interface -//*-* -//*-* 1. TGWin32Box (inline) -//*-* 2. TGWin32Clear (inline) -//*-* 3. TGWin32CopyTo -//*-* 4. TGWin32DrawPolyLine -//*-* 5. TGWin32DrawText -//*-* 6. TGWin32GetColor (inline) -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- - -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*TGWin32CopyTo*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- - -//______________________________________________________________________________ -TGWin32CopyTo::TGWin32CopyTo(TGWin32Object *obj, int xpost, int ypost, int xposf, int yposf, int code) - : TGWin32Command(code,ROOT_Pixmap){ - fSourceWinObject = obj; - - fPointFrom.x = xposf; - fPointFrom.y = yposf; - - fPointTo.x = xpost; - fPointTo.y = ypost; - -} - -//______________________________________________________________________________ -TGWin32Object *TGWin32CopyTo::GetSource(){ - return fSourceWinObject; -} - -//______________________________________________________________________________ -POINT *TGWin32CopyTo::GetPointsFrom(){ - return &fPointFrom; -} - -//______________________________________________________________________________ -POINT *TGWin32CopyTo::GetPointsTo(){ - return &fPointTo; -} -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*TGWin32DrawPolyLine*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- - -//______________________________________________________________________________ - TGWin32DrawPolyLine::TGWin32DrawPolyLine(int n, POINT *lpp, int code) : TGWin32Command(code){ - fNum = n; - flpPoint = lpp; - } - -//______________________________________________________________________________ - int TGWin32DrawPolyLine::GetNumber(){return fNum;} -//______________________________________________________________________________ - POINT *TGWin32DrawPolyLine::GetPoints(){return flpPoint;} - - -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- diff --git a/winnt/src/TWin32Application.cxx b/winnt/src/TWin32Application.cxx deleted file mode 100644 index 674162ce2a4..00000000000 --- a/winnt/src/TWin32Application.cxx +++ /dev/null @@ -1,228 +0,0 @@ -// @(#)root/winnt:$Name: $:$Id: TWin32Application.cxx,v 1.1 2002/08/18 22:52:10 fine Exp $ -// Author: Valery Fine 10/01/96 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -//______________________________________________________________________________ -//*-*-*-*-*-*-*-*-*The W I N 3 2 A p p l i c a t i o n class-*-*-*-*-*-*-* -//*-* ========================================== -//*-* -//*-* Basic interface to the WIN32 window system -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - -#include <process.h> - -#include "TWin32Application.h" -#include "TGWin32Command.h" -#include "TApplication.h" -#include "TROOT.h" - -#include "TError.h" - -#include "TWin32HookViaThread.h" - -#include <windows.h> -#undef GetWindow - -//______________________________________________________________________________ -unsigned int _stdcall ROOT_CmdLoop(HANDLE ThrSem) -//*-*-*-*-*-*-*-*-*-*-*-*-* ROOT_CmdLoop*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* ============ -//*-* Launch a separate thread to handle the ROOT command messages -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - { - MSG msg; - int erret; // GetMessage result - - ReleaseSemaphore(ThrSem, 1, NULL); - Bool_t EventLoopStop = kFALSE; - while(!EventLoopStop) - { - if (EventLoopStop = (!(erret=GetMessage(&msg,NULL,0,0)) || erret == -1)) - { - int err = GetLastError(); - if (err) printf( "ROOT_CmdLoop: GetMessage Error %d Last error was %d\n", erret, err); - continue; - } - -//*-* -//*-* GetMessage( ... ): -//*-* If the function retrieves a message other than WM_QUIT, -//*-* the return value is TRUE. -//*-* If the function retrieves the WM_QUIT, -//*-* the return value is FALSE. -//*-* If there is an error, -//*-* the return value is -1. -//*-* - - if ((msg.hwnd == NULL) && (msg.message == ROOT_CMD || msg.message == ROOT_SYNCH_CMD)) { - - if (TWin32HookViaThread::ExecuteEvent(&msg, msg.message==ROOT_SYNCH_CMD)) continue; - } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - // Delete GUI thread first - if (gVirtualX != gGXBatch) { - delete gVirtualX; - } - - fprintf(stderr," Leaving thread \n"); - if (erret == -1) - { - erret = GetLastError(); - Error("CmdLoop", "Error in GetMessage"); - Printf(" %d \n", erret); - } -// _endthreadex(0); - return 0; -} /* ROOT_CmdLoop */ - - -//______________________________________________________________________________ -unsigned int ROOT_DlgLoop(HANDLE ThrSem) -//*-*-*-*-*-*-*-*-*-*-*-*-* ROOT_DlgLoop*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* ============ -//*-* Launch a separate thread to handle the ROOT command messages -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - { - MSG msg; - int erret; // GetMessage result - - ReleaseSemaphore(ThrSem, 1, NULL); - Bool_t EventLoopStop = kFALSE; - while(!EventLoopStop) - { - if (EventLoopStop = (!(erret=GetMessage(&msg,NULL,0,0)) || erret == -1)) - continue; -//*-* -//*-* GetMessage( ... ): -//*-* If the function retrieves a message other than WM_QUIT, -//*-* the return value is TRUE. -//*-* If the function retrieves the WM_QUIT, -//*-* the return value is FALSE. -//*-* If there is an error, -//*-* the return value is -1. -//*-* - - if (msg.hwnd == NULL) ; - else { - if (msg.message != ROOT_CMD && msg.message != ROOT_SYNCH_CMD) - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - if (erret == -1) - { - erret = GetLastError(); - Error("CmdLoop", "Error in GetMessage"); - Printf( "%d \n", erret); - } - _endthreadex(0); - return 0; -} /* ROOT_DlgLoop */ - - - -// ClassImp(TWin32Application) - -//______________________________________________________________________________ -TWin32Application::TWin32Application(const char *appClassName, int *argc, - char **argv) - : fIDCmdThread(NULL) -{ - fApplicationName = appClassName; - SetConsoleTitle(appClassName); - CreateCmdThread(); -} -//______________________________________________________________________________ - TWin32Application::~TWin32Application() { - - if (fIDCmdThread) { - PostThreadMessage(fIDCmdThread,WM_QUIT,0,0); - if (WaitForSingleObject(fhdCmdThread,10000)==WAIT_FAILED) - TerminateThread(fhdCmdThread, -1); - CloseHandle(fhdCmdThread); - } -} - -//______________________________________________________________________________ -Int_t TWin32Application::CreateCmdThread() -{ - HANDLE ThrSem; - - // - // Create thread to do the cmd loop - // - - ThrSem = CreateSemaphore(NULL, 0, 1, NULL); - - - -#ifdef _SC_ - if ((Int_t)(fhdCmdThread = (HANDLE)_beginthreadex(NULL,0, (void *) ROOT_CmdLoop, - (LPVOID) ThrSem, 0, (void *)&fIDCmdThread)) == -1){ -#else - if ((Int_t)(fhdCmdThread = (HANDLE)_beginthreadex(NULL,0, ROOT_CmdLoop, - (LPVOID) ThrSem, 0, (unsigned int *)&fIDCmdThread)) == -1){ -#endif - - int erret = GetLastError(); - Error("CreatCmdThread", "Thread was not created"); - Printf(" %d \n", erret); - } - - WaitForSingleObject(ThrSem, INFINITE); - CloseHandle(ThrSem); - - return 0; -} - -//______________________________________________________________________________ -BOOL TWin32Application::ExecCommand(TGWin32Command *command,Bool_t synch) -{ -// To exec a command coming from the other threads - - BOOL postresult; - ERoot_Msgs cmd = ROOT_CMD; - if (fIDCmdThread == GetCurrentThreadId()) - Warning("ExecCommand","The dead lock danger"); - - if (synch) cmd = ROOT_SYNCH_CMD; - while (!(postresult = PostThreadMessage(fIDCmdThread, - cmd, - (WPARAM)command->GetCOP(), - (LPARAM)command)) - ){ ; } - return postresult; -} - -//______________________________________________________________________________ -void TWin32Application::Show(){; } -//______________________________________________________________________________ -void TWin32Application::Hide(){; } -//______________________________________________________________________________ -void TWin32Application::Iconify(){; } -//______________________________________________________________________________ -void TWin32Application::Init(){ ; } -//______________________________________________________________________________ -Bool_t TWin32Application::IsCmdThread() -{ - return (GetCurrentThreadId() == fIDCmdThread) ? kTRUE : kFALSE; -} -//______________________________________________________________________________ - void TWin32Application::Open(){; } -//______________________________________________________________________________ - void TWin32Application::Raise(){; } -//______________________________________________________________________________ - void TWin32Application::Lower(){; } diff --git a/winnt/src/TWin32HookViaThread.cxx b/winnt/src/TWin32HookViaThread.cxx deleted file mode 100644 index 24284edd608..00000000000 --- a/winnt/src/TWin32HookViaThread.cxx +++ /dev/null @@ -1,140 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Valery Fine(fine@vxcern.cern.ch) 31/07/96 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_Win32Constants -#include "Win32Constants.h" -#endif - -#ifndef ROOT_TWin32HookViaThread -#include "TWin32HookViaThread.h" -#endif - -#ifndef ROOT_TGWin32Command -#include "TGWin32Command.h" -#endif - -#ifndef ROOT_TROOT -#include "TROOT.h" -#endif - -#ifndef ROOT_TApplication -#include "TApplication.h" -#endif - -//______________________________________________________________________________ -void TWin32HookViaThread::ExecCommandThread(TGWin32Command *command,Bool_t synch) -{ -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* -//*-* Execute command via "Command" thread (main thread) -//*-* This allows to synchronize with the CINT commands -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -// Some extra flag is needed to mark the command = 0 turn !!! - - TGWin32Command *code = command; - if (!code) code = new TWin32SendClass(this); - fSendFlag = 1; - TApplication *appl = gROOT->GetApplication(); - if (appl) { - TApplicationImp *winapp = appl->GetApplicationImp(); - if (winapp) winapp->ExecCommand(code,synch); - } -} - -//______________________________________________________________________________ -void TWin32HookViaThread::ExecWindowThread(TGWin32Command *command) -{ -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* -//*-* Execute command via "Window" thread -//*-* This allows to synchronize with the user "window" actions, like -//*-* moving mouse pointing device , resize windows, involke pop-menus -//*-* rotate OpenGL 3D view, etc. -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -// Some extra flag is needed to mark the command = 0 turn !!! - - TGWin32Command *code = command; - if (!code) code = new TWin32SendClass(this); - fSendFlag = 1; - gVirtualX->ExecCommand(code); -} - -//______________________________________________________________________________ -Bool_t TWin32HookViaThread::ExecuteEvent(void *message,Bool_t synch, UInt_t type) -{ -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* TWin32HookViaThread::ExecuteEvent() -//*-* static function must be called from the Event Loop -//*-* to call TWin32HookViaThread::ExecThreadCB method via the -//*-* another thread. -//*-* -//*-* Input: -//*-* void *message - a pointer to the current messaged retrieved -//*-* Bool_t synch - kTRUE = - synchronize this command with the -//*-* "console" command (those came from the -//*-* keyboard/stdin) -//*-* -//*-* Return: -//*-* -//*-* kTRUE - message was processed -//*-* kFALSE - message was refused -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - if (!message) return kFALSE; - if (type == UInt_t(-1)) type = ROOT_CMD; - - MSG *msg = (MSG *)message; - Bool_t res = kFALSE; - -// if (msg->hwnd == NULL & == type) - { - LPARAM lParam = msg->lParam; - - int ireply = IDRETRY; - if (synch) - while (gROOT->IsLineProcessing() && ireply == IDRETRY) - { - MessageBeep(MB_ICONEXCLAMATION); - ireply = MessageBox(NULL, - "ROOT is busy. Sorry. Try later","ROOT is busy", - MB_ICONEXCLAMATION | MB_RETRYCANCEL | MB_TASKMODAL); - }; - - if (!synch || (ireply == IDRETRY && !gROOT->IsLineProcessing()) ) - { - if (synch) gROOT->SetLineIsProcessing(); - // printf(" Code op is %d \n", (ESendClassCOPs)msg->wParam); - switch ((ESendClassCOPs)msg->wParam) - { - case kSendClass: - ((TWin32HookViaThread *)(((TWin32SendClass *)lParam)->GetPointer()))-> - ExecThreadCB((TWin32SendClass *)lParam); - res = kTRUE; - break; - case kSendWaitClass: - { - TWin32SendWaitClass *org = (TWin32SendWaitClass *)lParam; - TWin32SendClass *orgbas = (TWin32SendClass *)org; - TWin32HookViaThread *hook = (TWin32HookViaThread *)(org->GetPointer()); - hook->ExecThreadCB(orgbas); - // org->Release(); - res = kTRUE; - break; - } - default: - break; - } - if (synch) gROOT->SetLineHasBeenProcessed(); - } - } - return res; -} diff --git a/winnt/src/TWin32Timer.cxx b/winnt/src/TWin32Timer.cxx deleted file mode 100644 index 34811d7aaad..00000000000 --- a/winnt/src/TWin32Timer.cxx +++ /dev/null @@ -1,319 +0,0 @@ -// @(#)root/winnt:$Name: $:$Id: TWin32Timer.cxx,v 1.4 2002/06/20 21:02:52 brun Exp $ -// Author: Valery Fine(fine@mail.cern.ch) 29/09/98 - -#include <process.h> - -#include "Windows4Root.h" -#include "TTimer.h" -#include "TROOT.h" -#include "TWin32Timer.h" -#include "TWin32HookViaThread.h" -#include "TGWin32Command.h" -#include "TInterpreter.h" - -struct WIN32TIMETHREAD { - HANDLE ThrSem; - TWin32Timer *ti; - } ; - -enum ETimerCallbackCmd {kCreateTimer, kKillTimer}; -const Char_t *TIMERCLASS = "Timer"; -//*-* -//*-* Macros to call the Callback methods via Timer thread: -//*-* -#define CallMethodThread(_function,_p1,_p2,_p3) \ - else \ - { \ - TWin32SendWaitClass code(this,(UInt_t)k##_function,(UInt_t)(_p1),(UInt_t)(_p2),(UInt_t)(_p3)); \ - ExecTimerThread(&code); \ - if (code.GetCOP()!=-1) code.Wait(); \ - } -#define ReturnMethodThread(_type,_function,_p1,_p2) \ - else \ - { \ - _type _local; \ - TWin32SendWaitClass code(this,(UInt_t)k##_function,(UInt_t)(_p1),(UInt_t)(_p2),(UInt_t)(&_local)); \ - ExecTimerThread(&code); \ - if (code.GetCOP()!=-1) code.Wait(); \ - return _local; \ - } - -//*-* -#define CallWindowMethod1(_function,_p1) \ - if ( IsTimeThread()) \ - {TWin32Timer::_function##CB(_p1);} \ - CallMethodThread(_function,_p1,0,0) -//*-* -#define CallWindowMethod(_function) \ - if ( IsTimeThread()) \ - {TWin32Timer::_function##CB();} \ - CallMethodThread(_function,0,0,0) - -//*-* -#define ReturnWindowMethod1(_type,_function,_p1) \ - if ( IsTimeThread()) \ - {return TWin32Timer::_function##CB(_p1);} \ - ReturnMethodThread(_type,_function,_p1,0) -//*-* -#define ReturnWindowMethod(_type,_function) \ - if ( IsTimeThread()) \ - {return TWin32Timer::_function##CB();} \ - ReturnMethodThread(_type,_function,0,0) - -//______________________________________________________________________________ -static VOID CALLBACK DispatchTimers(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) -{ -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- -//*-* -//*-* HWND hwnd, // handle of window for timer messages -//*-* UINT uMsg, // WM_TIMER message -//*-* UINT idEvent, // timer identifier (pointer to TTimer object) -//*-* DWORD dwTime // current system time -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- - - TTimer *ti = (TTimer *)idEvent; - if (ti) { - if (ti->IsAsync()) - ti->Notify(); - else - gROOT->ProcessLine(Form("((TTimer *)0x%lx)->Notify();",(Long_t)ti)); - } -} - -//______________________________________________________________________________ -static LRESULT APIENTRY WndTimer(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ -////////////////////////////////////////////////////////////////////////// -// // -// Main Universal Windows procedure to manage all dispatched events // -// // -////////////////////////////////////////////////////////////////////////// - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); -} - -//______________________________________________________________________________ -static unsigned int _stdcall ROOT_TimerLoop(void *threadcmd) -{ - //--------------------------------------- - // Create windows - HWND fhdTimerWindow = CreateWindowEx(NULL, - TIMERCLASS, - NULL, // address of window name - WS_DISABLED , // window style - 0,0, // start positio of the window, - 0, 0, // size of the window - NULL, // handle of parent of owner window - NULL, // handle of menu, or child-window identifier - GetModuleHandle(NULL), // handle of application instance - NULL); // address of window-creation data - HANDLE ThrSem = ((WIN32TIMETHREAD *)threadcmd)->ThrSem; - ((WIN32TIMETHREAD *)threadcmd)->ti->SetHWND(fhdTimerWindow); - //--------------------------------------- - MSG msg; - int erret; // GetMessage result - - ReleaseSemaphore(ThrSem, 1, NULL); - Bool_t EventLoopStop = kFALSE; - // create timer - while(!EventLoopStop) - { - if (EventLoopStop = (!(erret=GetMessage(&msg,NULL,0,0)) || erret == -1)) - continue; - if (msg.hwnd == NULL && (msg.message == ROOT_CMD || msg.message == ROOT_SYNCH_CMD)) - if (TWin32HookViaThread::ExecuteEvent(&msg, msg.message==ROOT_SYNCH_CMD)) continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - if (erret == -1) - { - erret = GetLastError(); - fprintf(stderr," *** Error **** TimerLoop: %d \n", erret); - } - - if (msg.wParam) ReleaseSemaphore((HANDLE) msg.wParam, 1, NULL); - - _endthreadex(0); - return 0; -} /* ROOT_MsgLoop */ - - -//______________________________________________________________________________ -TWin32Timer::TWin32Timer() -{ - fhdTimerWindow = 0; - fhdTimerThread = 0; - fhdTimerThreadId = 0; -} -//______________________________________________________________________________ -TWin32Timer::~TWin32Timer() -{ - if (fhdTimerThreadId) { - PostThreadMessage(fhdTimerThreadId,WM_QUIT,0,0); - if (WaitForSingleObject(fhdTimerThread,10000)==WAIT_FAILED) - TerminateThread(fhdTimerThread, -1); - CloseHandle(fhdTimerThread); - } -} -//______________________________________________________________________________ -Int_t TWin32Timer::CreateTimerThread() -{ - // Register class "Timer" - HMODULE instance = GetModuleHandle(NULL); - static const WNDCLASS timerwindowclass = { - CS_GLOBALCLASS - , WndTimer - , 0, 0 - , instance - , NULL, NULL, NULL, NULL - , TIMERCLASS}; - WNDCLASSEX timerinfo; - if (GetClassInfoEx(instance,TIMERCLASS,&timerinfo)) - return 0; - if (!RegisterClass( &timerwindowclass)) - { - DWORD l_err = GetLastError(); - printf(" Last Error is %d \n", l_err); - return -1; - } - - WIN32TIMETHREAD threadcmd; - - - // - // Create thread to do the cmd loop - // - - threadcmd.ThrSem = CreateSemaphore(NULL, 0, 1, NULL); - threadcmd.ti = this; - -// fhdTimerThread = (HANDLE)_beginthreadex(NULL,0, ROOT_TimerLoop, - fhdTimerThread = (unsigned long *) _beginthreadex(NULL,0, ROOT_TimerLoop, - (LPVOID) &threadcmd, 0, ((unsigned *)&fhdTimerThreadId)); - - if (Int_t(fhdTimerThread) == -1){ - int erret = GetLastError(); - printf(" *** Error *** CreatTimerThread <Thread was not created> %d \n", erret); - } - - WaitForSingleObject(threadcmd.ThrSem, INFINITE); - CloseHandle(threadcmd.ThrSem); - - return 0; -} -//______________________________________________________________________________ -UInt_t TWin32Timer::CreateTimer(TTimer *timer) -{ - if(!fhdTimerThreadId) CreateTimerThread(); - CallWindowMethod1(CreateTimer,timer); - return 0; -} -//______________________________________________________________________________ -void TWin32Timer::CreateTimerCB(TTimer *timer) -{ - if (timer) - timer->SetTimerID((UInt_t)(::SetTimer(fhdTimerWindow,(UINT)timer, - (unsigned long)timer->GetTime(), - (TIMERPROC) ::DispatchTimers)) ); -} -//______________________________________________________________________________ -void TWin32Timer::ExecTimerThread(TGWin32Command *command) -{ -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* -//*-* Execute command via "Timer" thread -//*-* -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -// Some extra flag is needed to mark the command = 0 turn !!! - TGWin32Command *code = command; - if (!code) code = new TWin32SendClass(this); - fSendFlag = 1; - int i = ExecCommand(code,kFALSE); - if (!i) code->SetCOP(-1); -} -//______________________________________________________________________________ -Bool_t TWin32Timer::ExecCommand(TGWin32Command *command,Bool_t synch) -{ -// To exec a command coming from the other threads - - BOOL postresult; - ERoot_Msgs cmd = ROOT_CMD; - if (fhdTimerThreadId == GetCurrentThreadId()) - printf("TWin32Timer::ExecCommand --- > The dead lock danger\n"); - - if (synch) cmd = ROOT_SYNCH_CMD; - while (!(postresult = PostThreadMessage(fhdTimerThreadId, - cmd, - (WPARAM)command->GetCOP(), - (LPARAM)command)) - ){ ; - // 1444 Invalid thread identifier. ERROR_INVALID_THREAD_ID - if ( GetLastError() == ERROR_INVALID_THREAD_ID ) { - // The thread is gone ... not needed to insist. - return false; - } - } - return postresult; -} - -//______________________________________________________________________________ -Bool_t TWin32Timer::IsTimeThread(){ - return fhdTimerThreadId == GetCurrentThreadId(); -} - -//______________________________________________________________________________ -void TWin32Timer::KillTimer(TTimer *timer) -{ - CallWindowMethod1(KillTimer,timer); -} -//______________________________________________________________________________ -void TWin32Timer::KillTimerCB(TTimer *timer) -{ - if(timer) { - // ::KillTimer(NULL,timer->GetTimerID()); - ::KillTimer(fhdTimerWindow,(UINT)timer); - timer->SetTimerID(0); - } -} - - -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//*-* Callback methods: -//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -//______________________________________________________________________________ -void TWin32Timer::ExecThreadCB(TWin32SendClass *command) -{ - ETimerCallbackCmd cmd = (ETimerCallbackCmd)(command->GetData(0)); - Bool_t debug = kFALSE; - char *listcmd[] = { - "CreateTimer" - ,"KillTimer" - }; - - if (gDebug) printf("TWin32Timer: commamd %d: %s",cmd,listcmd[cmd]); - switch (cmd) - { - case kCreateTimer: - { - TTimer *ti = (TTimer *)(command->GetData(1)); - if (gDebug) printf(" %lx ", (Long_t)ti); - CreateTimerCB(ti); - break; - } - case kKillTimer: - { - TTimer *ti = (TTimer *)(command->GetData(1)); - if (gDebug) printf(" %lx ", (Long_t)ti); - KillTimerCB(ti); - break; - } - default: - break; - } - if (gDebug) printf(" \n"); - if (LOWORD(command->GetCOP()) == kSendWaitClass) - ((TWin32SendWaitClass *)command)->Release(); - else - delete command; -} diff --git a/winnt/src/TWinNTInput.cxx b/winnt/src/TWinNTInput.cxx deleted file mode 100644 index 4fdff3ffffc..00000000000 --- a/winnt/src/TWinNTInput.cxx +++ /dev/null @@ -1,68 +0,0 @@ -// @(#)root/winnt:$Name$:$Id$ -// Author: Fons Rademakers 02/04/95 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -// // -// TWinNTInput // -// // -// This class encapsulates input callback from file descriptors. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TWinNTInput.h" -#include "TApplication.h" - - -ClassImp(TWinNTInput) - - -TWinNTInput::TWinNTInput() -{ - fFd = -1; -} - -TWinNTInput::~TWinNTInput() -{ -} - - void TWinNTInput::Attach(int fd, int mask) - { - if (fFd != -1) - Remove(); - - fFd = fd; - - AllocConsole(); -} - -void TWinNTInput::Remove() -{ - if (fFd != -1) - FreeConsole(); - fFd = -1; -} - -int TWinNTInput::Fd() -{ - return fFd; -} - -int TWinNTInput::Id() -{ - return 0; -} - -void TWinNTInput::InputHandler(void * clientData, int *, void *) -{ - TWinNTInput *obj = (TWinNTInput*)clientData; - -} - diff --git a/winnt/src/TWinNTSystem.cxx b/winnt/src/TWinNTSystem.cxx index 7cb852ec0f4..2b5a19376df 100644 --- a/winnt/src/TWinNTSystem.cxx +++ b/winnt/src/TWinNTSystem.cxx @@ -1,4 +1,4 @@ -// @(#)root/winnt:$Name: $:$Id: TWinNTSystem.cxx,v 1.152 2006/11/15 23:51:28 rdm Exp $ +// @(#)root/winnt:$Name: $:$Id: TWinNTSystem.cxx,v 1.153 2006/11/28 13:59:19 rdm Exp $ // Author: Fons Rademakers 15/09/95 /************************************************************************* @@ -34,11 +34,9 @@ #include "TApplication.h" #include "TWin32SplashThread.h" #include "Win32Constants.h" -#include "TWin32HookViaThread.h" -#include "TWin32Timer.h" -#include "TGWin32Command.h" #include "TInterpreter.h" #include "TObjString.h" +#include "TVirtualX.h" #include <sys/utime.h> #include <sys/timeb.h> @@ -408,34 +406,6 @@ namespace { } #pragma auto_inline(on) - /////////////////////////////////////////////////////////////////////////////// - class TTermInputLine : public TWin32HookViaThread { - - protected: - void ExecThreadCB(TWin32SendClass *sentclass); - public: - TTermInputLine::TTermInputLine(); - }; - - //______________________________________________________________________________ - TTermInputLine::TTermInputLine() - { - // - - TWin32SendWaitClass CodeOp(this); - ExecCommandThread(&CodeOp, kFALSE); - CodeOp.Wait(); - } - - //______________________________________________________________________________ - void TTermInputLine::ExecThreadCB(TWin32SendClass *code) - { - // Dispatch a single event. - - gROOT->GetApplication()->HandleTermInput(); - ((TWin32SendWaitClass *)code)->Release(); - } - //______________________________________________________________________________ unsigned __stdcall HandleConsoleThread(void *pArg ) { @@ -751,10 +721,6 @@ TWinNTSystem::TWinNTSystem() : TSystem("WinNT", "WinNT System") fhProcess = ::GetCurrentProcess(); fDirNameBuffer = 0; - fShellName = 0; - fWin32Timer = 0; - fhSmallIconList = 0; - fhNormalIconList = 0; WSADATA WSAData; int initwinsock = 0; @@ -777,8 +743,6 @@ TWinNTSystem::~TWinNTSystem() { // dtor - SafeDelete(fWin32Timer); - // Revert back the accuracy of Sleep() without needing to link to winmm.lib typedef UINT (WINAPI* LPTIMEENDPERIOD)( UINT uPeriod ); HINSTANCE hInstWinMM = LoadLibrary( "winmm.dll" ); @@ -796,16 +760,6 @@ TWinNTSystem::~TWinNTSystem() fDirNameBuffer = 0; } - if (fhSmallIconList) { - ImageList_Destroy(fhSmallIconList); - fhSmallIconList = 0; - } - - if (fhNormalIconList) { - ImageList_Destroy(fhNormalIconList); - fhNormalIconList = 0; - } - if (gConsoleEvent) { ::ResetEvent(gConsoleEvent); ::CloseHandle(gConsoleEvent); @@ -941,117 +895,6 @@ const char *TWinNTSystem::BaseName(const char *name) return 0; } -//______________________________________________________________________________ -void TWinNTSystem::CreateIcons() -{ - // - - const char *shellname = fShellName; - - HINSTANCE hShellInstance = ::LoadLibrary(shellname); - fhSmallIconList = 0; - fhNormalIconList = 0; - - if (hShellInstance) { - fhSmallIconList = ImageList_Create(::GetSystemMetrics(SM_CXSMICON), - ::GetSystemMetrics(SM_CYSMICON), - ILC_MASK, kTotalNumOfICons, 1); - - fhNormalIconList = ImageList_Create(::GetSystemMetrics(SM_CXICON), - ::GetSystemMetrics(SM_CYICON), - ILC_MASK, kTotalNumOfICons, 1); - HICON hicon; - HICON hDummyIcon = ::LoadIcon(NULL, IDI_APPLICATION); - - // Add "ROOT" main icon - hicon = ::LoadIcon(::GetModuleHandle(NULL), MAKEINTRESOURCE(101)); - if (!hicon) { - hicon = ::LoadIcon(hShellInstance, MAKEINTRESOURCE(101)); - } - if (!hicon) hicon = hDummyIcon; - ImageList_AddIcon(fhSmallIconList, hicon); - ImageList_AddIcon(fhNormalIconList, hicon); - if (hicon != hDummyIcon) ::DeleteObject(hicon); - - // Add "Canvas" icon - hicon = ::LoadIcon(hShellInstance, MAKEINTRESOURCE(16)); - if (!hicon) hicon = hDummyIcon; - ImageList_AddIcon(fhSmallIconList, hicon); - ImageList_AddIcon(fhNormalIconList, hicon); - if (hicon != hDummyIcon) ::DeleteObject(hicon); - - // Add "Browser" icon - hicon = ::LoadIcon(hShellInstance,MAKEINTRESOURCE(171)); - if (!hicon) hicon = hDummyIcon; - ImageList_AddIcon(fhSmallIconList, hicon); - ImageList_AddIcon(fhNormalIconList, hicon); - if (hicon != hDummyIcon) ::DeleteObject(hicon); - - // Add "Closed Folder" icon - hicon = ::LoadIcon(hShellInstance, MAKEINTRESOURCE(4)); - if (!hicon) hicon = hDummyIcon; - ImageList_AddIcon(fhSmallIconList, hicon); - ImageList_AddIcon(fhNormalIconList, hicon); - if (hicon != hDummyIcon) ::DeleteObject(hicon); - - // Add the "Open Folder" icon - hicon = LoadIcon(hShellInstance, MAKEINTRESOURCE(5)); - if (!hicon) hicon = hDummyIcon; - ImageList_AddIcon(fhSmallIconList, hicon); - ImageList_AddIcon(fhNormalIconList, hicon); - if (hicon != hDummyIcon) ::DeleteObject(hicon); - - // Add the "Document" icon - hicon = ::LoadIcon(hShellInstance, MAKEINTRESOURCE(152)); - if (!hicon) hicon = hDummyIcon; - ImageList_AddIcon(fhSmallIconList, hicon); - ImageList_AddIcon(fhNormalIconList, hicon); - if (hicon != hDummyIcon) ::DeleteObject(hicon); - - ::FreeLibrary((HMODULE)hShellInstance); - } -} - -//______________________________________________________________________________ -void TWinNTSystem::SetShellName(const char *name) -{ - // - - const char *shellname = "SHELL32.DLL"; - - if (name) { - fShellName = new char[lstrlen(name)+1]; - strcpy((char *)fShellName, name); - } else { -//*-* use the system "shell32.dll" file as the icons stock. -//*-* Check the type of the OS - OSVERSIONINFO OsVersionInfo; - -//*-* Value Platform -//*-* ---------------------------------------------------- -//*-* VER_PLATFORM_WIN32s Win32s on Windows 3.1 -//*-* VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95 -//*-* VER_PLATFORM_WIN32_NT Windows NT -//*-* - OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&OsVersionInfo); - if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) { - fShellName = strcpy(new char[lstrlen(shellname)+1], shellname); - } else { - // for Windows 95 we have to create a local copy this file - const char *rootdir = gRootDir; - const char newshellname[] = "bin/RootShell32.dll"; - fShellName = ConcatFileName(gRootDir, newshellname); - - char sysdir[1024]; - ::GetSystemDirectory(sysdir, 1024); - char *sysfile = (char *) ConcatFileName(sysdir, shellname); - CopyFile(sysfile, fShellName, TRUE); // TRUE means "don't overwrite if fShellName is exists - delete [] sysfile; - } - } -} - //______________________________________________________________________________ void TWinNTSystem::SetProgname(const char *name) { -- GitLab