summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx31
-rw-r--r--src/Fl_x.cxx27
-rw-r--r--src/vsnprintf.c14
3 files changed, 56 insertions, 16 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index a83e6307e..b16f1b92b 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_win32.cxx,v 1.33.2.33 2001/04/22 16:54:23 spitzak Exp $"
+// "$Id: Fl_win32.cxx,v 1.33.2.34 2001/04/27 14:39:27 easysw Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@@ -418,8 +418,6 @@ static Fl_Window* resize_bug_fix;
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
-
-#if 1
// Matt: When dragging a full window, MSWindows on 'slow'
// machines can lose track of the window refresh area. It sends some kind
// of panic message to the desktop that in turn sends this message on to
@@ -434,7 +432,6 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
cnt = 0;
} else cnt = 1;
} else if (uMsg == WM_PAINT) cnt = 0;
-#endif
fl_msg.message = uMsg;
@@ -510,6 +507,30 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
}
break;
+ case WM_ACTIVATEAPP:
+ // From eric@vfx.sel.sony.com, we should process WM_ACTIVATEAPP
+ // messages to restore the correct state of the shift/ctrl/alt/lock
+ // keys... Added control, shift, alt, and meta keys, mouse buttons,
+ // and changed to use GetAsyncKeyState...
+ if (!wParam)
+ {
+ ulong state = 0;
+ if (GetAsyncKeyState(VK_CAPITAL)) state |= FL_CAPS_LOCK;
+ if (GetAsyncKeyState(VK_NUMLOCK)) state |= FL_NUM_LOCK;
+ if (GetAsyncKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK;
+ if (GetAsyncKeyState(VK_CONTROL)) state |= FL_CTRL;
+ if (GetAsyncKeyState(VK_SHIFT)) state |= FL_SHIFT;
+ if (GetAsyncKeyState(VK_MENU)) state |= FL_ALT;
+ if (GetAsyncKeyState(VK_LWIN) ||
+ GetAsyncKeyState(VK_RWIN)) state |= FL_META;
+ if (GetAsyncKeyState(VK_LBUTTON)) state |= FL_BUTTON1;
+ if (GetAsyncKeyState(VK_MBUTTON)) state |= FL_BUTTON2;
+ if (GetAsyncKeyState(VK_RBUTTON)) state |= FL_BUTTON3;
+ Fl::e_state = state;
+ return 0;
+ }
+ break;
+
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
@@ -955,5 +976,5 @@ void Fl_Window::make_current() {
}
//
-// End of "$Id: Fl_win32.cxx,v 1.33.2.33 2001/04/22 16:54:23 spitzak Exp $".
+// End of "$Id: Fl_win32.cxx,v 1.33.2.34 2001/04/27 14:39:27 easysw Exp $".
//
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 2b83932db..8905e0f40 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.24.2.23 2001/01/22 15:13:40 easysw Exp $"
+// "$Id: Fl_x.cxx,v 1.24.2.24 2001/04/27 14:39:27 easysw Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -69,23 +69,38 @@ static int maxfd;
static int nfds = 0;
static int fd_array_size = 0;
-static struct FD {
+struct FD {
#if !USE_POLL
int fd;
short events;
#endif
void (*cb)(int, void*);
void* arg;
-} *fd = 0;
+};
+
+static FD *fd = 0;
void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
remove_fd(n,events);
int i = nfds++;
if (i >= fd_array_size) {
+ FD *temp;
fd_array_size = 2*fd_array_size+1;
- fd = (FD*)realloc(fd, fd_array_size*sizeof(FD));
+
+ if (!fd) temp = (FD*)malloc(fd_array_size*sizeof(FD));
+ else temp = (FD*)realloc(fd, fd_array_size*sizeof(FD));
+
+ if (!temp) return;
+ fd = temp;
+
#if USE_POLL
- pollfds = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd));
+ pollfd *tpoll;
+
+ if (!pollfds) tpoll = (pollfd*)malloc(fd_array_size*sizeof(pollfd));
+ else tpoll = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd));
+
+ if (!tpoll) return;
+ pollfds = tpoll;
#endif
}
fd[i].cb = cb;
@@ -903,5 +918,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.23 2001/01/22 15:13:40 easysw Exp $".
+// End of "$Id: Fl_x.cxx,v 1.24.2.24 2001/04/27 14:39:27 easysw Exp $".
//
diff --git a/src/vsnprintf.c b/src/vsnprintf.c
index 6774bcf56..e60b3b16f 100644
--- a/src/vsnprintf.c
+++ b/src/vsnprintf.c
@@ -1,5 +1,5 @@
/*
- * "$Id: vsnprintf.c,v 1.3.2.4 2001/01/22 15:13:41 easysw Exp $"
+ * "$Id: vsnprintf.c,v 1.3.2.5 2001/04/27 14:39:27 easysw Exp $"
*
* vsnprintf() function for the Fast Light Tool Kit (FLTK).
*
@@ -41,12 +41,16 @@
#include <stdarg.h>
#include <config.h>
-#if !HAVE_VSNPRINTF
+#ifdef HAVE_SYS_STDTYPES_H
+# include <sys/stdtypes.h>
+#endif /* HAVE_SYS_STDTYPES_H */
#ifdef __cplusplus
extern "C" {
#endif
+#if !HAVE_VSNPRINTF
+
int vsnprintf(char* str, size_t size, const char* fmt, va_list ap) {
const char* e = str+size-1;
char* p = str;
@@ -124,13 +128,13 @@ int snprintf(char* str, size_t size, const char* fmt, ...) {
return ret;
}
-#ifdef __cplusplus
-}
#endif
+#ifdef __cplusplus
+}
#endif
/*
- * End of "$Id: vsnprintf.c,v 1.3.2.4 2001/01/22 15:13:41 easysw Exp $".
+ * End of "$Id: vsnprintf.c,v 1.3.2.5 2001/04/27 14:39:27 easysw Exp $".
*/