fltk/src/fl_call_main.c

91 lines
3.1 KiB
C
Raw Normal View History

/*
* "$Id: fl_call_main.c,v 1.1.2.11 2001/04/25 13:34:43 easysw Exp $"
*
* Copyright 1998-2001 by Bill Spitzak and others.
*
* fl_call_main() calls main() for you Windows people. Needs to be done in C
* because Borland C++ won't let you call main() from C++.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "fltk-bugs@fltk.org".
*/
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
/*
* This WinMain() function can be overridden by an application and
* is provided for compatibility with programs written for other
* operating systems that conform to the ANSI standard entry point
* "main()". This will allow you to build a WIN32 Application
* without any special settings.
*
* Because of problems with the Microsoft Visual C++ header files
* and/or compiler, you cannot have a WinMain function in a DLL.
* I don't know why. Thus, this nifty feature is only available
* if you link to the static library.
*
* Currently the debug version of this library will create a
* console window for your application so you can put printf()
* statements for debugging or informational purposes. Ultimately
* we want to update this to always use the parent's console,
* but at present we have not identified a function or API in
* Microsoft(r) Windows(r) that allows for it.
*/
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
#if defined(WIN32) && !defined(FL_DLL) && !defined (__GNUC__)
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
extern int main(int, char *[]);
#ifdef BORLAND5
#define __argc _argc
#define __argv _argv
#endif
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
#ifdef _DEBUG
/*
* If we are using compiling in debug mode, open a console window so
* we can see any printf's, etc...
*
* While we can detect if the program was run from the command-line -
* look at the CMDLINE environment variable, it will be "WIN" for
* programs started from the GUI - the shell seems to run all WIN32
* applications in the background anyways...
*/
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
AllocConsole();
freopen("conin$", "r", stdin);
freopen("conout$", "w", stdout);
freopen("conout$", "w", stderr);
#endif /* _DEBUG */
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
/* Run the standard main entry point function... */
return main(__argc, __argv);
}
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
#else
/* This code to prevent "empty translation unit" or similar warnings... */
static void dummy(void) {dummy();}
These are some (hopefully minor) changes we keep needing to edit into each new version of fltk for use at Digital Domain. These were found by running a diff between 1.0.6 and our inhouse version. 1. WinMain is moved to the fl_call_main.c file so that it can easily be conditionally-compiled out (code copied from fltk 2.0, not tested!) 2. Fl_win32 ignores the value of window->xclass(). This seemed to cause problems when windows had different xclass() in the same app and did not have any useful effect on windows. This value is changed to set the icon of the app on X. 3. sgi pragmas added to x.H to turn off warnings from their broken xlib header files. Please tell me if this causes any sgi compilers to complain, we should add more stuff to the #ifdef to stop that. 4. Fl_Gl_Window::ortho() changed so that text and images are not erased if the origin is off the left/bottom of the window. 5. Small change to Fl_Input so that a click that gives it the focus also selects all the text. This is more windoze-like and it seems the users really like it. Note also that we had to set USE_XDBE to zero to get things to work on the newest Irix machines. I give up, Xdbe has been nothing but an impossible and confusing mess and it is obvious that the X servers are not testing it and thus it is suffering from software rot so it is unlikely to work anywhere in the future. Not sure if we want to switch it off in the official version, though. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1999-10-14 08:56:09 +04:00
#endif
/*
* End of "$Id: fl_call_main.c,v 1.1.2.11 2001/04/25 13:34:43 easysw Exp $".
*/