Fixed a name conflict with new (VC 2008 Express) winsock2.h versions
(POLLIN, POLLOUT, POLLERR) and another conflict (FORCE_POSITION flag) that produced compile errors with VC 2008 (STR #2301). Removed remaining code of the obsolete WSAAsyncSelect call from Fl_win32.cxx. Removed some obsolete html tags from FL/Fl_Window.H and fixed some typos. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6980 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
954fba25c8
commit
9a505ef44c
3
CHANGES
3
CHANGES
@ -1,5 +1,8 @@
|
||||
CHANGES IN FLTK 1.3.0
|
||||
|
||||
- Fixed a name conflict with new (VC 2008 Express) winsock2.h
|
||||
versions and another conflict that produced compile errors
|
||||
with VC 2008 (STR #2301).
|
||||
- Widgets now remove stale entries from the default callback
|
||||
queue when they are deleted (STR #2302)
|
||||
- Moved OS X code base to the more moder Cocoa toolkit thanks
|
||||
|
232
FL/Fl_Window.H
232
FL/Fl_Window.H
@ -43,15 +43,17 @@ class Fl_X;
|
||||
window, with a border and title and all the window management controls,
|
||||
or a "subwindow" inside a window. This is controlled by whether or not
|
||||
the window has a parent().
|
||||
<P>Once you create a window, you usually add children Fl_Widget
|
||||
's to it by using window->add(child) for each new widget. See Fl_Group for more information
|
||||
on how to add and remove children. </P>
|
||||
<P>There are several subclasses of Fl_Window that provide
|
||||
double-buffering, overlay, menu, and OpenGL support. </P>
|
||||
<P>The window's callback is done if the user tries to close a window
|
||||
using the window manager and
|
||||
Fl::modal() is zero or equal to the window. Fl_Window
|
||||
has a default callback that calls Fl_Window::hide().
|
||||
|
||||
Once you create a window, you usually add children Fl_Widget
|
||||
's to it by using window->add(child) for each new widget.
|
||||
See Fl_Group for more information on how to add and remove children.
|
||||
|
||||
There are several subclasses of Fl_Window that provide
|
||||
double-buffering, overlay, menu, and OpenGL support.
|
||||
|
||||
The window's callback is done if the user tries to close a window
|
||||
using the window manager and Fl::modal() is zero or equal to the
|
||||
window. Fl_Window has a default callback that calls Fl_Window::hide().
|
||||
*/
|
||||
class FL_EXPORT Fl_Window : public Fl_Group {
|
||||
|
||||
@ -77,20 +79,42 @@ class FL_EXPORT Fl_Window : public Fl_Group {
|
||||
|
||||
protected:
|
||||
|
||||
/** Stores the last window that was made current. See current() const */
|
||||
/** Stores the last window that was made current. See current() const */
|
||||
static Fl_Window *current_;
|
||||
virtual void draw();
|
||||
/** Forces the window to be drawn, this window is also made current and calls draw(). */
|
||||
virtual void flush();
|
||||
|
||||
/**
|
||||
Sets an internal flag that tells FLTK and the window manager to
|
||||
honor position requests.
|
||||
|
||||
This is used internally and should not be needed by user code.
|
||||
|
||||
\param[in] force 1 to set the FORCE_POSITION flag, 0 to clear it
|
||||
*/
|
||||
void force_position(int force) {
|
||||
if (force) set_flag(FORCE_POSITION);
|
||||
else clear_flag(FORCE_POSITION);
|
||||
}
|
||||
/**
|
||||
Returns the internal state of the window's FORCE_POSITION flag.
|
||||
|
||||
\retval 1 if flag is set
|
||||
\retval 0 otherwise
|
||||
|
||||
\see force_position(int)
|
||||
*/
|
||||
int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Creates a window from the given size and title.
|
||||
If Fl_Group::current() is not NULL, the window is created as a
|
||||
subwindow of the parent window.</p>
|
||||
subwindow of the parent window.
|
||||
|
||||
<p>The first form of the constructor creates a top-level window
|
||||
The first form of the constructor creates a top-level window
|
||||
and asks the window manager to position the window. The second
|
||||
form of the constructor either creates a subwindow or a
|
||||
top-level window at the specified location (x,y) , subject to window
|
||||
@ -99,28 +123,31 @@ public:
|
||||
or allow the user to pick a location. Use position(x,y)
|
||||
or hotspot() before calling show() to request a
|
||||
position on the screen. See Fl_Window::resize()
|
||||
for some more details on positioning windows.</p>
|
||||
for some more details on positioning windows.
|
||||
|
||||
<p>Top-level windows initially have visible() set to 0
|
||||
Top-level windows initially have visible() set to 0
|
||||
and parent() set to NULL. Subwindows initially
|
||||
have visible() set to 1 and parent() set to
|
||||
the parent window pointer.</p>
|
||||
the parent window pointer.
|
||||
|
||||
<P>Fl_Widget::box() defaults to FL_FLAT_BOX. If you
|
||||
plan to completely fill the window with children widgets you should
|
||||
Fl_Widget::box() defaults to FL_FLAT_BOX. If you plan to
|
||||
completely fill the window with children widgets you should
|
||||
change this to FL_NO_BOX. If you turn the window border off
|
||||
you may want to change this to FL_UP_BOX.
|
||||
|
||||
\see Fl_Window(int x, int y, int w, int h, const char* title = 0)
|
||||
*/
|
||||
Fl_Window(int w, int h, const char* title= 0);
|
||||
/** Creates a window from the given position, size and title.
|
||||
See Fl_Window::Fl_Window(int w, int h, const char *title = 0)
|
||||
/** Creates a window from the given position, size and title.
|
||||
|
||||
\see Fl_Window::Fl_Window(int w, int h, const char *title = 0)
|
||||
*/
|
||||
Fl_Window(int x, int y, int w, int h, const char* title = 0);
|
||||
/**
|
||||
The destructor <I>also deletes all the children</I>. This allows a
|
||||
whole tree to be deleted at once, without having to keep a pointer to
|
||||
all the children in the user code. A kludge has been done so the
|
||||
Fl_Window and all of it's children can be automatic (local)
|
||||
Fl_Window and all of its children can be automatic (local)
|
||||
variables, but you must declare the Fl_Window <I>first</I> so
|
||||
that it is destroyed last.
|
||||
*/
|
||||
@ -129,16 +156,16 @@ public:
|
||||
virtual int handle(int);
|
||||
|
||||
/**
|
||||
Changes the size and position of the window. If shown() is
|
||||
true, these changes are communicated to the window server (which may
|
||||
Changes the size and position of the window. If shown() is true,
|
||||
these changes are communicated to the window server (which may
|
||||
refuse that size and cause a further resize). If shown() is
|
||||
false, the size and position are used when show() is called.
|
||||
See Fl_Group for the effect
|
||||
of resizing on the child widgets.
|
||||
<P>You can also call the Fl_Widget methods size(x,y)
|
||||
and position(w,h), which are inline wrappers for this virtual
|
||||
function. </P>
|
||||
<P>A top-level window can not force, but merely suggest a position and
|
||||
See Fl_Group for the effect of resizing on the child widgets.
|
||||
|
||||
You can also call the Fl_Widget methods size(x,y) and position(w,h),
|
||||
which are inline wrappers for this virtual function.
|
||||
|
||||
A top-level window can not force, but merely suggest a position and
|
||||
size to the operating system. The window manager may not be willing or
|
||||
able to display a window at the desired position or with the given
|
||||
dimensions. It is up to the application developer to verify window
|
||||
@ -146,21 +173,21 @@ public:
|
||||
*/
|
||||
virtual void resize(int,int,int,int);
|
||||
/**
|
||||
Gets or sets whether or not the window manager border is around the
|
||||
window. The default value is true. border(n) can be used to
|
||||
turn the border on and off, and returns non-zero if the value has been
|
||||
changed. <I>Under most X window managers this does not work after
|
||||
show() has been called, although SGI's 4DWM does work.</I>
|
||||
Sets whether or not the window manager border is around the
|
||||
window. The default value is true. void border(int) can be
|
||||
used to turn the border on and off. <I>Under most X window
|
||||
managers this does not work after show() has been called,
|
||||
although SGI's 4DWM does work.</I>
|
||||
*/
|
||||
void border(int b);
|
||||
/**
|
||||
Fast inline function to turn the border
|
||||
Fast inline function to turn the window manager border
|
||||
off. It only works before show() is called.
|
||||
*/
|
||||
void clear_border() {set_flag(NOBORDER);}
|
||||
/** See int Fl_Window::border(int) */
|
||||
/** See void Fl_Window::border(int) */
|
||||
unsigned int border() const {return !(flags() & NOBORDER);}
|
||||
/** Activate the flags NOBORDER|FL_OVERRIDE */
|
||||
/** Activates the flags NOBORDER|FL_OVERRIDE */
|
||||
void set_override() {set_flag(NOBORDER|OVERRIDE);}
|
||||
/** Returns non zero if FL_OVERRIDE flag is set, 0 otherwise. */
|
||||
unsigned int override() const { return flags()&OVERRIDE; }
|
||||
@ -170,8 +197,7 @@ public:
|
||||
remain on top of the other windows (if the X window manager supports
|
||||
the "transient for" property). Several modal windows may be shown at
|
||||
once, in which case only the last one shown gets events. You can see
|
||||
which window (if any) is modal by calling
|
||||
Fl::modal().
|
||||
which window (if any) is modal by calling Fl::modal().
|
||||
*/
|
||||
void set_modal() {set_flag(MODAL);}
|
||||
/** Returns true if this window is modal. */
|
||||
@ -188,14 +214,14 @@ public:
|
||||
|
||||
/**
|
||||
Marks the window as a menu window.
|
||||
|
||||
|
||||
This is intended for internal use, but it can also be used if you
|
||||
write your own menu handling. However, this is not recommended.
|
||||
|
||||
This flag is used for correct "parenting" of windows in communication
|
||||
with the windowing system. Modern X window managers can use different
|
||||
flags to distinguish menu and tooltip windows from normal windows.
|
||||
|
||||
|
||||
This must be called before the window is shown and cannot be changed
|
||||
later.
|
||||
*/
|
||||
@ -206,14 +232,14 @@ public:
|
||||
|
||||
/**
|
||||
Marks the window as a tooltip window.
|
||||
|
||||
|
||||
This is intended for internal use, but it can also be used if you
|
||||
write your own tooltip handling. However, this is not recommended.
|
||||
|
||||
This flag is used for correct "parenting" of windows in communication
|
||||
with the windowing system. Modern X window managers can use different
|
||||
flags to distinguish menu and tooltip windows from normal windows.
|
||||
|
||||
|
||||
This must be called before the window is shown and cannot be changed
|
||||
later.
|
||||
|
||||
@ -226,8 +252,8 @@ public:
|
||||
unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
|
||||
|
||||
/**
|
||||
Position the window so that the mouse is pointing at the
|
||||
given position, or at the center of the given widget, which may be the
|
||||
Positions the window so that the mouse is pointing at the given
|
||||
position, or at the center of the given widget, which may be the
|
||||
window itself. If the optional offscreen parameter is
|
||||
non-zero, then the window is allowed to extend off the screen (this
|
||||
does not work with some X window managers). \see position()
|
||||
@ -237,43 +263,49 @@ public:
|
||||
void hotspot(const Fl_Widget*, int offscreen = 0);
|
||||
/** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
|
||||
void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
|
||||
|
||||
/**
|
||||
Undoes the effect of a previous resize() or show()
|
||||
so that the next time show() is called the window manager is
|
||||
free to position the window.
|
||||
Undoes the effect of a previous resize() or show() so that the next time
|
||||
show() is called the window manager is free to position the window.
|
||||
|
||||
This is for Forms compatibility only.
|
||||
|
||||
\deprecated please use force_position(0) instead
|
||||
*/
|
||||
void free_position() {clear_flag(FORCE_POSITION);}
|
||||
/**
|
||||
Set the allowable range the user can resize this window to. This only
|
||||
works for top-level windows.
|
||||
Sets the allowable range the user can resize this window to.
|
||||
This only works for top-level windows.
|
||||
<UL>
|
||||
<LI>minw and minh are the smallest the window can
|
||||
be. Either value must be greater than 0.</LI>
|
||||
<LI>maxw and maxh are the largest the window can be.
|
||||
If either is <I>equal</I> to the minimum then you cannot resize in
|
||||
that direction. If either is zero then FLTK picks a maximum size in
|
||||
that direction such that the window will fill the screen. </LI>
|
||||
<LI>dw and dh are size increments. The window will
|
||||
be constrained to widths of minw + N * dw, where N
|
||||
is any non-negative integer. If these are less or equal to 1 they
|
||||
are ignored. (this is ignored on WIN32)</LI>
|
||||
<LI>aspect is a flag that indicates that the window should
|
||||
preserve it's aspect ratio. This only works if both the maximum and
|
||||
minimum have the same aspect ratio. (ignored on WIN32 and by many X
|
||||
window managers)</LI>
|
||||
<LI>minw and minh are the smallest the window can be.
|
||||
Either value must be greater than 0.</LI>
|
||||
<LI>maxw and maxh are the largest the window can be. If either is
|
||||
<I>equal</I> to the minimum then you cannot resize in that direction.
|
||||
If either is zero then FLTK picks a maximum size in that direction
|
||||
such that the window will fill the screen.</LI>
|
||||
<LI>dw and dh are size increments. The window will be constrained
|
||||
to widths of minw + N * dw, where N is any non-negative integer.
|
||||
If these are less or equal to 1 they are ignored (this is ignored
|
||||
on WIN32).</LI>
|
||||
<LI>aspect is a flag that indicates that the window should preserve its
|
||||
aspect ratio. This only works if both the maximum and minimum have
|
||||
the same aspect ratio (ignored on WIN32 and by many X window managers).
|
||||
</LI>
|
||||
</UL>
|
||||
|
||||
If this function is not called, FLTK tries to figure out the range
|
||||
from the setting of resizable():
|
||||
<UL>
|
||||
<LI>If resizable() is NULL (this is the default)
|
||||
then the window cannot be resized and the resize border and max-size
|
||||
control will not be displayed for the window. </LI>
|
||||
<LI>If either dimension of resizable() is less than 100,
|
||||
then that is considered the minimum size. Otherwise the
|
||||
resizable() has a minimum size of 100. </LI>
|
||||
<LI>If either dimension of resizable() is zero, then that is
|
||||
also the maximum size (so the window cannot resize in that direction). </LI>
|
||||
<LI>If resizable() is NULL (this is the default) then the window cannot
|
||||
be resized and the resize border and max-size control will not be
|
||||
displayed for the window.</LI>
|
||||
<LI>If either dimension of resizable() is less than 100, then that is
|
||||
considered the minimum size. Otherwise the resizable() has a minimum
|
||||
size of 100.</LI>
|
||||
<LI>If either dimension of resizable() is zero, then that is also the
|
||||
maximum size (so the window cannot resize in that direction).</LI>
|
||||
</UL>
|
||||
|
||||
It is undefined what happens if the current size does not fit in the
|
||||
constraints passed to size_range().
|
||||
*/
|
||||
@ -284,11 +316,11 @@ public:
|
||||
const char* label() const {return Fl_Widget::label();}
|
||||
/** See void Fl_Window::iconlabel(const char*) */
|
||||
const char* iconlabel() const {return iconlabel_;}
|
||||
/** Sets the window title bar label. */
|
||||
/** Sets the window title bar label. */
|
||||
void label(const char*);
|
||||
/** Sets the icon label. */
|
||||
void iconlabel(const char*);
|
||||
/** Gets or sets the icon label. */
|
||||
/** Sets the icon label. */
|
||||
void label(const char* label, const char* iconlabel); // platform dependent
|
||||
void copy_label(const char* a);
|
||||
/** See void Fl_Window::xclass(const char*) */
|
||||
@ -301,36 +333,38 @@ public:
|
||||
the second one if the first is 'x'. Thus "foo" turns into "foo, Foo",
|
||||
and "xprog.1" turns into "xprog, XProg".</I> This only works if called <I>
|
||||
before</I> calling show().
|
||||
<P>Under Microsoft Windows this string is used as the name of the
|
||||
|
||||
Under Microsoft Windows this string is used as the name of the
|
||||
WNDCLASS structure, though it is not clear if this can have any
|
||||
visible effect. The passed pointer is stored unchanged. The string
|
||||
is not copied.
|
||||
*/
|
||||
void xclass(const char* c) {xclass_ = c;}
|
||||
/** Gets the current icon window target dependent data */
|
||||
/** Gets the current icon window target dependent data. */
|
||||
const void* icon() const {return icon_;}
|
||||
/** Sets the current icon window target dependent data */
|
||||
/** Sets the current icon window target dependent data. */
|
||||
void icon(const void * ic) {icon_ = ic;}
|
||||
|
||||
/**
|
||||
Returns non-zero if show() has been called (but not hide()
|
||||
). You can tell if a window is iconified with (w->shown()
|
||||
&!w->visible()).
|
||||
). You can tell if a window is iconified with (w->shown()
|
||||
&& !w->visible()).
|
||||
*/
|
||||
int shown() {return i != 0;}
|
||||
/**
|
||||
Put the window on the screen. Usually this has the side effect of
|
||||
opening the display. The second form is used for top-level
|
||||
windows and allow standard arguments to be parsed from the
|
||||
Puts the window on the screen. Usually (on X) this has the side
|
||||
effect of opening the display. The second form is used for top-level
|
||||
windows and allows standard arguments to be parsed from the
|
||||
command-line.
|
||||
<P>If the window is already shown then it is restored and raised to the
|
||||
|
||||
If the window is already shown then it is restored and raised to the
|
||||
top. This is really convenient because your program can call show()
|
||||
at any time, even if the window is already up. It also means that
|
||||
show() serves the purpose of raise() in other toolkits.
|
||||
*/
|
||||
virtual void show();
|
||||
/**
|
||||
Remove the window from the screen. If the window is already hidden or
|
||||
Removes the window from the screen. If the window is already hidden or
|
||||
has not been shown then this does nothing and is harmless.
|
||||
*/
|
||||
virtual void hide();
|
||||
@ -353,11 +387,14 @@ public:
|
||||
Iconifies the window. If you call this when shown() is false
|
||||
it will show() it as an icon. If the window is already
|
||||
iconified this does nothing.
|
||||
<P>Call show() to restore the window. </P>
|
||||
<P>When a window is iconified/restored (either by these calls or by the
|
||||
|
||||
Call show() to restore the window.
|
||||
|
||||
When a window is iconified/restored (either by these calls or by the
|
||||
user) the handle() method is called with FL_HIDE and
|
||||
FL_SHOW events and visible() is turned on and off. </P>
|
||||
<P>There is no way to control what is drawn in the icon except with the
|
||||
FL_SHOW events and visible() is turned on and off.
|
||||
|
||||
There is no way to control what is drawn in the icon except with the
|
||||
string passed to Fl_Window::xclass(). You should not rely on
|
||||
window managers displaying the icons.
|
||||
*/
|
||||
@ -368,13 +405,13 @@ public:
|
||||
|
||||
static Fl_Window *current();
|
||||
/**
|
||||
Sets things up so that the drawing functions in <FL/fl_draw.H> will go into this
|
||||
window. This is useful for incremental update of windows, such as in an
|
||||
idle callback, which will make your program behave much better if it
|
||||
draws a slow graphic. <B>Danger: incremental update is very hard to
|
||||
Sets things up so that the drawing functions in <FL/fl_draw.H> will go
|
||||
into this window. This is useful for incremental update of windows, such
|
||||
as in an idle callback, which will make your program behave much better
|
||||
if it draws a slow graphic. <B>Danger: incremental update is very hard to
|
||||
debug and maintain!</B>
|
||||
<P>This method only works for the Fl_Window and
|
||||
Fl_Gl_Window derived classes.
|
||||
|
||||
This method only works for the Fl_Window and Fl_Gl_Window derived classes.
|
||||
*/
|
||||
void make_current();
|
||||
|
||||
@ -382,14 +419,15 @@ public:
|
||||
/**
|
||||
Changes the cursor for this window. This always calls the system, if
|
||||
you are changing the cursor a lot you may want to keep track of how
|
||||
you set it in a static varaible and call this only if the new cursor
|
||||
is different.
|
||||
you set it in a static variable and call this only if the new cursor
|
||||
is different.
|
||||
|
||||
<P>The type Fl_Cursor is an enumeration defined in <Enumerations.H>.
|
||||
The type Fl_Cursor is an enumeration defined in <FL/Enumerations.H>.
|
||||
(Under X you can get any XC_cursor value by passing
|
||||
Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are
|
||||
not implemented on WIN32.
|
||||
<P> For back compatibility only.
|
||||
|
||||
For back compatibility only.
|
||||
*/
|
||||
void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
|
||||
void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
|
||||
|
@ -101,11 +101,10 @@
|
||||
#endif
|
||||
typedef int (WINAPI* fl_wsk_select_f)(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
|
||||
typedef int (WINAPI* fl_wsk_fd_is_set_f)(SOCKET, fd_set *);
|
||||
typedef int (WINAPI* fl_wsk_async_select_f)(SOCKET,HWND,u_int,long);
|
||||
|
||||
static HMODULE s_wsock_mod = 0;
|
||||
static fl_wsk_select_f s_wsock_select=0;
|
||||
static fl_wsk_fd_is_set_f fl_wsk_fd_is_set=0;
|
||||
static fl_wsk_async_select_f fl_wsk_async_select=0;
|
||||
|
||||
static HMODULE get_wsock_mod() {
|
||||
if (!s_wsock_mod) {
|
||||
@ -114,7 +113,6 @@ static HMODULE get_wsock_mod() {
|
||||
Fl::fatal("FLTK Lib Error: %s file not found! Please check your winsock dll accessibility.\n",WSCK_DLL_NAME);
|
||||
s_wsock_select = (fl_wsk_select_f) GetProcAddress(s_wsock_mod, "select");
|
||||
fl_wsk_fd_is_set = (fl_wsk_fd_is_set_f) GetProcAddress(s_wsock_mod, "__WSAFDIsSet");
|
||||
fl_wsk_async_select = (fl_wsk_async_select_f) GetProcAddress(s_wsock_mod, "WSAAsyncSelect");
|
||||
}
|
||||
return s_wsock_mod;
|
||||
}
|
||||
@ -229,14 +227,18 @@ static Fl_Window *track_mouse_win=0; // current TrackMouseEvent() window
|
||||
//
|
||||
// Microsoft provides the Berkeley select() call and an asynchronous
|
||||
// select function that sends a WIN32 message when the select condition
|
||||
// exists...
|
||||
// exists. However, we don't try to use the asynchronous WSAAsyncSelect()
|
||||
// any more for good reasons (see above).
|
||||
//
|
||||
// A.S. Dec 2009: We got reports that current winsock2.h files define
|
||||
// POLLIN, POLLOUT, and POLLERR with conflicting values WRT what we
|
||||
// used before (STR #2301). Therefore we must not use these values
|
||||
// for our internal purposes, but use FL_READ, FL_WRITE, and
|
||||
// FL_EXCEPT, as defined for use in Fl::add_fd().
|
||||
//
|
||||
static int maxfd = 0;
|
||||
static fd_set fdsets[3];
|
||||
|
||||
# define POLLIN 1
|
||||
# define POLLOUT 4
|
||||
# define POLLERR 8
|
||||
|
||||
#if !defined(__GNUC__) || __GNUC__ >= 3
|
||||
extern IDropTarget *flIDropTarget;
|
||||
#endif // !__GNUC__ || __GNUC__ >= 3
|
||||
@ -292,14 +294,14 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
|
||||
fd[i].cb = cb;
|
||||
fd[i].arg = v;
|
||||
|
||||
if (events & POLLIN) FD_SET((unsigned)n, &fdsets[0]);
|
||||
if (events & POLLOUT) FD_SET((unsigned)n, &fdsets[1]);
|
||||
if (events & POLLERR) FD_SET((unsigned)n, &fdsets[2]);
|
||||
if (events & FL_READ) FD_SET((unsigned)n, &fdsets[0]);
|
||||
if (events & FL_WRITE) FD_SET((unsigned)n, &fdsets[1]);
|
||||
if (events & FL_EXCEPT) FD_SET((unsigned)n, &fdsets[2]);
|
||||
if (n > maxfd) maxfd = n;
|
||||
}
|
||||
|
||||
void Fl::add_fd(int fd, void (*cb)(int, void*), void* v) {
|
||||
Fl::add_fd(fd, POLLIN, cb, v);
|
||||
Fl::add_fd(fd, FL_READ, cb, v);
|
||||
}
|
||||
|
||||
void Fl::remove_fd(int n, int events) {
|
||||
@ -318,9 +320,9 @@ void Fl::remove_fd(int n, int events) {
|
||||
}
|
||||
nfds = j;
|
||||
|
||||
if (events & POLLIN) FD_CLR(unsigned(n), &fdsets[0]);
|
||||
if (events & POLLOUT) FD_CLR(unsigned(n), &fdsets[1]);
|
||||
if (events & POLLERR) FD_CLR(unsigned(n), &fdsets[2]);
|
||||
if (events & FL_READ) FD_CLR(unsigned(n), &fdsets[0]);
|
||||
if (events & FL_WRITE) FD_CLR(unsigned(n), &fdsets[1]);
|
||||
if (events & FL_EXCEPT) FD_CLR(unsigned(n), &fdsets[2]);
|
||||
}
|
||||
|
||||
void Fl::remove_fd(int n) {
|
||||
@ -374,9 +376,9 @@ int fl_wait(double time_to_wait) {
|
||||
for (int i = 0; i < nfds; i ++) {
|
||||
SOCKET f = fd[i].fd;
|
||||
short revents = 0;
|
||||
if (fl_wsk_fd_is_set(f, &fdt[0])) revents |= POLLIN;
|
||||
if (fl_wsk_fd_is_set(f, &fdt[1])) revents |= POLLOUT;
|
||||
if (fl_wsk_fd_is_set(f, &fdt[2])) revents |= POLLERR;
|
||||
if (fl_wsk_fd_is_set(f, &fdt[0])) revents |= FL_READ;
|
||||
if (fl_wsk_fd_is_set(f, &fdt[1])) revents |= FL_WRITE;
|
||||
if (fl_wsk_fd_is_set(f, &fdt[2])) revents |= FL_EXCEPT;
|
||||
if (fd[i].events & revents) fd[i].cb(f, fd[i].arg);
|
||||
}
|
||||
time_to_wait = 0.0; // just peek for any messages
|
||||
@ -1292,7 +1294,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
|
||||
int resize_from_program = (this != resize_bug_fix);
|
||||
if (!resize_from_program) resize_bug_fix = 0;
|
||||
if (X != x() || Y != y()) {
|
||||
set_flag(FORCE_POSITION);
|
||||
force_position(1);
|
||||
} else {
|
||||
if (!is_a_resize) return;
|
||||
flags |= SWP_NOMOVE;
|
||||
@ -1474,7 +1476,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
wp += 2*bx;
|
||||
hp += 2*by+bt;
|
||||
}
|
||||
if (!(w->flags() & Fl_Widget::FORCE_POSITION)) {
|
||||
if (!w->force_position()) {
|
||||
xp = yp = CW_USEDEFAULT;
|
||||
} else {
|
||||
if (!Fl::grab()) {
|
||||
|
Loading…
Reference in New Issue
Block a user