mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 15:32:12 +08:00
Fixed Compiling with mingw-w64 (STR #2308).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7978 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
CHANGES IN FLTK 1.3.0
|
CHANGES IN FLTK 1.3.0
|
||||||
|
|
||||||
|
- Fixed Compiling with mingw-w64 (STR #2308).
|
||||||
- Fixed crashes when detecting illegal utf 8 sequences
|
- Fixed crashes when detecting illegal utf 8 sequences
|
||||||
in Fl_Text_* widgets (STR #2348)
|
in Fl_Text_* widgets (STR #2348)
|
||||||
- Fixed Fl_Text_Display Tabulator calculations (STR #2450)
|
- Fixed Fl_Text_Display Tabulator calculations (STR #2450)
|
||||||
|
|||||||
+1
-1
@@ -241,7 +241,7 @@ struct FL_EXPORT Fl_Menu_Item {
|
|||||||
and casting the long to a void* and may not be
|
and casting the long to a void* and may not be
|
||||||
portable to some machines.
|
portable to some machines.
|
||||||
*/
|
*/
|
||||||
long argument() const {return (long)user_data_;}
|
long argument() const {return (long)(fl_intptr_t)user_data_;}
|
||||||
/**
|
/**
|
||||||
For convenience you can also define the callback as taking a long
|
For convenience you can also define the callback as taking a long
|
||||||
argument. This is implemented by casting this to a Fl_Callback
|
argument. This is implemented by casting this to a Fl_Callback
|
||||||
|
|||||||
+13
-1
@@ -33,6 +33,18 @@
|
|||||||
|
|
||||||
#include "Enumerations.H"
|
#include "Enumerations.H"
|
||||||
|
|
||||||
|
/**
|
||||||
|
\todo typedef's fl_intptr_t and fl_uintptr_t should be documented.
|
||||||
|
*/
|
||||||
|
#ifdef _WIN64
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef intptr_t fl_intptr_t;
|
||||||
|
typedef uintptr_t fl_uintptr_t;
|
||||||
|
#else
|
||||||
|
typedef long fl_intptr_t;
|
||||||
|
typedef unsigned long fl_uintptr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
class Fl_Widget;
|
class Fl_Widget;
|
||||||
class Fl_Window;
|
class Fl_Window;
|
||||||
class Fl_Group;
|
class Fl_Group;
|
||||||
@@ -587,7 +599,7 @@ public:
|
|||||||
|
|
||||||
/** Gets the current user data (long) argument that is passed to the callback function.
|
/** Gets the current user data (long) argument that is passed to the callback function.
|
||||||
*/
|
*/
|
||||||
long argument() const {return (long)user_data_;}
|
long argument() const {return (long)(fl_intptr_t)user_data_;}
|
||||||
|
|
||||||
/** Sets the current user data (long) argument that is passed to the callback function.
|
/** Sets the current user data (long) argument that is passed to the callback function.
|
||||||
\todo The user data value must be implemented using a \em union to avoid
|
\todo The user data value must be implemented using a \em union to avoid
|
||||||
|
|||||||
@@ -1142,7 +1142,7 @@ static Fl_Menu_Item alignmenu[] = {
|
|||||||
{0}};
|
{0}};
|
||||||
|
|
||||||
void align_cb(Fl_Button* i, void *v) {
|
void align_cb(Fl_Button* i, void *v) {
|
||||||
Fl_Align b = Fl_Align(long(i->user_data()));
|
Fl_Align b = Fl_Align(fl_uintptr_t(i->user_data()));
|
||||||
if (v == LOAD) {
|
if (v == LOAD) {
|
||||||
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
|
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
|
||||||
i->value(current_widget->o->align() & b);
|
i->value(current_widget->o->align() & b);
|
||||||
@@ -1190,7 +1190,7 @@ void align_position_cb(Fl_Choice *i, void *v) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const Fl_Menu_Item *mi = i->menu() + i->value();
|
const Fl_Menu_Item *mi = i->menu() + i->value();
|
||||||
Fl_Align b = Fl_Align(long(mi->user_data()));
|
Fl_Align b = Fl_Align(fl_uintptr_t(mi->user_data()));
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||||
if (o->selected && o->is_widget()) {
|
if (o->selected && o->is_widget()) {
|
||||||
@@ -1219,7 +1219,7 @@ void align_text_image_cb(Fl_Choice *i, void *v) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const Fl_Menu_Item *mi = i->menu() + i->value();
|
const Fl_Menu_Item *mi = i->menu() + i->value();
|
||||||
Fl_Align b = Fl_Align(long(mi->user_data()));
|
Fl_Align b = Fl_Align(fl_uintptr_t(mi->user_data()));
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||||
if (o->selected && o->is_widget()) {
|
if (o->selected && o->is_widget()) {
|
||||||
@@ -1311,7 +1311,7 @@ void user_data_type_cb(Fl_Input *i, void *v) {
|
|||||||
// "v_attributes" let user type in random code for attribute settings:
|
// "v_attributes" let user type in random code for attribute settings:
|
||||||
|
|
||||||
void v_input_cb(Fl_Input* i, void* v) {
|
void v_input_cb(Fl_Input* i, void* v) {
|
||||||
int n = int(long(i->user_data()));
|
int n = fl_intptr_t(i->user_data());
|
||||||
if (v == LOAD) {
|
if (v == LOAD) {
|
||||||
i->static_value(current_widget->extra_code(n));
|
i->static_value(current_widget->extra_code(n));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -1978,7 +1978,7 @@ FILE * Fl_Process::popen(const char *cmd, const char *mode) {
|
|||||||
// don't need theses handles inherited by child process:
|
// don't need theses handles inherited by child process:
|
||||||
clean_close(pin[0]); clean_close(pout[1]); clean_close(perr[1]);
|
clean_close(pin[0]); clean_close(pout[1]); clean_close(perr[1]);
|
||||||
HANDLE & h = *mode == 'r' ? pout[0] : pin[1];
|
HANDLE & h = *mode == 'r' ? pout[0] : pin[1];
|
||||||
_fpt = _fdopen(_open_osfhandle((long) h,_O_BINARY),mode);
|
_fpt = _fdopen(_open_osfhandle((fl_intptr_t) h,_O_BINARY),mode);
|
||||||
h= INVALID_HANDLE_VALUE; // reset the handle pointer that is shared
|
h= INVALID_HANDLE_VALUE; // reset the handle pointer that is shared
|
||||||
// with _fpt so we don't free it twice
|
// with _fpt so we don't free it twice
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -33,8 +33,20 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
#include <FL/x.H>
|
|
||||||
#include <FL/Fl_Tooltip.H>
|
#include <FL/Fl_Tooltip.H>
|
||||||
|
|
||||||
|
// recent versions of MinGW warn us "Please include winsock2.h before windows.h"
|
||||||
|
// hence we must include winsock*.h before FL/x.H (A.S. Dec. 2010)
|
||||||
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
|
# if !defined(USE_WSOCK1)
|
||||||
|
# include <winsock2.h>
|
||||||
|
# else
|
||||||
|
# include <winsock.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <FL/x.H>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
+2
-7
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#ifndef FL_DOXYGEN
|
#ifndef FL_DOXYGEN
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/x.H>
|
|
||||||
#include <FL/fl_utf8.h>
|
#include <FL/fl_utf8.h>
|
||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
@@ -46,13 +45,8 @@
|
|||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#else
|
|
||||||
# if !defined(USE_WSOCK1)
|
|
||||||
# include <winsock2.h>
|
|
||||||
#else
|
|
||||||
# include <winsock.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
// note: the corresponding winsock*.h has been #include'd in Fl.cxx
|
||||||
#if !defined(USE_WSOCK1)
|
#if !defined(USE_WSOCK1)
|
||||||
# define WSCK_DLL_NAME "WS2_32.DLL"
|
# define WSCK_DLL_NAME "WS2_32.DLL"
|
||||||
#else
|
#else
|
||||||
@@ -60,6 +54,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <FL/x.H>
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
# include <wchar.h>
|
# include <wchar.h>
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ static char avoidRecursion = 0;
|
|||||||
// pointer to one of the buttons or an Fl_Window* pointer to the
|
// pointer to one of the buttons or an Fl_Window* pointer to the
|
||||||
// message window (message_form).
|
// message window (message_form).
|
||||||
static void button_cb(Fl_Widget *, void *val) {
|
static void button_cb(Fl_Widget *, void *val) {
|
||||||
ret_val = (int)(long)val;
|
ret_val = (fl_intptr_t)val;
|
||||||
message_form->hide();
|
message_form->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,6 @@
|
|||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
|
||||||
#include <winsock2.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char *fl_selection_buffer[2];
|
extern char *fl_selection_buffer[2];
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ Drawing *d;
|
|||||||
|
|
||||||
void slider_cb(Fl_Widget* o, void* v) {
|
void slider_cb(Fl_Widget* o, void* v) {
|
||||||
Fl_Slider* s = (Fl_Slider*)o;
|
Fl_Slider* s = (Fl_Slider*)o;
|
||||||
args[long(v)] = s->value();
|
args[fl_intptr_t(v)] = s->value();
|
||||||
d->redraw();
|
d->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ Fl_Cursor cursor = FL_CURSOR_DEFAULT;
|
|||||||
Fl_Hor_Value_Slider *cursor_slider;
|
Fl_Hor_Value_Slider *cursor_slider;
|
||||||
|
|
||||||
void choice_cb(Fl_Widget *, void *v) {
|
void choice_cb(Fl_Widget *, void *v) {
|
||||||
cursor = (Fl_Cursor)(long)v;
|
cursor = (Fl_Cursor)(fl_intptr_t)v;
|
||||||
cursor_slider->value(cursor);
|
cursor_slider->value(cursor);
|
||||||
fl_cursor(cursor,fg,bg);
|
fl_cursor(cursor,fg,bg);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ void points_cb(Fl_Widget* o, void*) {
|
|||||||
|
|
||||||
void slider_cb(Fl_Widget* o, void* v) {
|
void slider_cb(Fl_Widget* o, void* v) {
|
||||||
Fl_Slider* s = (Fl_Slider*)o;
|
Fl_Slider* s = (Fl_Slider*)o;
|
||||||
args[long(v)] = s->value();
|
args[fl_intptr_t(v)] = s->value();
|
||||||
d->redraw();
|
d->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -765,11 +765,11 @@ void MenuInit(void)
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
// FLTK-style callbacks to Glut menu callback translators:
|
// FLTK-style callbacks to Glut menu callback translators:
|
||||||
void setlevel(Fl_Widget*, void *value) {setlevel(long(value));}
|
void setlevel(Fl_Widget*, void *value) {setlevel(fl_intptr_t(value));}
|
||||||
|
|
||||||
void choosefract(Fl_Widget*, void *value) {choosefract(long(value));}
|
void choosefract(Fl_Widget*, void *value) {choosefract(fl_intptr_t(value));}
|
||||||
|
|
||||||
void handlemenu(Fl_Widget*, void *value) {handlemenu(long(value));}
|
void handlemenu(Fl_Widget*, void *value) {handlemenu(fl_intptr_t(value));}
|
||||||
|
|
||||||
#include <FL/Fl_Button.H>
|
#include <FL/Fl_Button.H>
|
||||||
#include <FL/Fl_Group.H>
|
#include <FL/Fl_Group.H>
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ void button_cb(Fl_Widget *,void *) {
|
|||||||
|
|
||||||
void color_cb(Fl_Widget* button, void* v) {
|
void color_cb(Fl_Widget* button, void* v) {
|
||||||
Fl_Color c;
|
Fl_Color c;
|
||||||
switch ((long)v) {
|
switch ((fl_intptr_t)v) {
|
||||||
case 0: c = FL_BACKGROUND2_COLOR; break;
|
case 0: c = FL_BACKGROUND2_COLOR; break;
|
||||||
case 1: c = FL_SELECTION_COLOR; break;
|
case 1: c = FL_SELECTION_COLOR; break;
|
||||||
default: c = FL_FOREGROUND_COLOR; break;
|
default: c = FL_FOREGROUND_COLOR; break;
|
||||||
|
|||||||
+2
-2
@@ -109,14 +109,14 @@ int main(int argc, char** argv) {
|
|||||||
for (int i = 0; i < window->children(); i++) {
|
for (int i = 0; i < window->children(); i++) {
|
||||||
Fl_Widget* b = window->child(i);
|
Fl_Widget* b = window->child(i);
|
||||||
if (b->callback() == (Fl_Callback*)key_cb) {
|
if (b->callback() == (Fl_Callback*)key_cb) {
|
||||||
int i = (long)b->user_data();
|
int i = b->argument();
|
||||||
if (!i) i = b->label()[0];
|
if (!i) i = b->label()[0];
|
||||||
Fl_Button *btn = ((Fl_Button*)b);
|
Fl_Button *btn = ((Fl_Button*)b);
|
||||||
int state = Fl::event_key(i);
|
int state = Fl::event_key(i);
|
||||||
if (btn->value()!=state)
|
if (btn->value()!=state)
|
||||||
btn->value(state);
|
btn->value(state);
|
||||||
} else if (b->callback() == (Fl_Callback*)shift_cb) {
|
} else if (b->callback() == (Fl_Callback*)shift_cb) {
|
||||||
int i = (long)b->user_data();
|
int i = b->argument();
|
||||||
Fl_Button *btn = ((Fl_Button*)b);
|
Fl_Button *btn = ((Fl_Button*)b);
|
||||||
int state = Fl::event_state(i);
|
int state = Fl::event_state(i);
|
||||||
if (btn->value()!=state)
|
if (btn->value()!=state)
|
||||||
|
|||||||
+3
-3
@@ -58,9 +58,9 @@ void test_box::draw() {
|
|||||||
dashes[3] = char(sliders[8]->value());
|
dashes[3] = char(sliders[8]->value());
|
||||||
dashes[4] = 0;
|
dashes[4] = 0;
|
||||||
fl_line_style(
|
fl_line_style(
|
||||||
(long)(choice[0]->mvalue()->user_data()) +
|
(long)(choice[0]->mvalue()->argument()) +
|
||||||
(long)(choice[1]->mvalue()->user_data()) +
|
(long)(choice[1]->mvalue()->argument()) +
|
||||||
(long)(choice[2]->mvalue()->user_data()),
|
(long)(choice[2]->mvalue()->argument()),
|
||||||
(long)(sliders[3]->value()), // width
|
(long)(sliders[3]->value()), // width
|
||||||
dashes);
|
dashes);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -71,7 +71,7 @@ void box_cb(Fl_Widget* o, void*) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void type_cb(Fl_Widget*, void* v) {
|
void type_cb(Fl_Widget*, void* v) {
|
||||||
thescroll->type((uchar)((long)v));
|
thescroll->type((uchar)((fl_intptr_t)v));
|
||||||
thescroll->redraw();
|
thescroll->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ Fl_Menu_Item choices[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void align_cb(Fl_Widget*, void* v) {
|
void align_cb(Fl_Widget*, void* v) {
|
||||||
thescroll->scrollbar.align((uchar)((long)v));
|
thescroll->scrollbar.align((uchar)((fl_intptr_t)v));
|
||||||
thescroll->redraw();
|
thescroll->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -273,19 +273,19 @@ char *itoa(int val)
|
|||||||
|
|
||||||
void tablebox_choice_cb(Fl_Widget *w, void *data)
|
void tablebox_choice_cb(Fl_Widget *w, void *data)
|
||||||
{
|
{
|
||||||
G_table->table_box((Fl_Boxtype)(long)data);
|
G_table->table_box((Fl_Boxtype)(fl_intptr_t)data);
|
||||||
G_table->redraw();
|
G_table->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widgetbox_choice_cb(Fl_Widget *w, void *data)
|
void widgetbox_choice_cb(Fl_Widget *w, void *data)
|
||||||
{
|
{
|
||||||
G_table->box((Fl_Boxtype)(long)data);
|
G_table->box((Fl_Boxtype)(fl_intptr_t)data);
|
||||||
G_table->resize(G_table->x(), G_table->y(), G_table->w(), G_table->h());
|
G_table->resize(G_table->x(), G_table->y(), G_table->w(), G_table->h());
|
||||||
}
|
}
|
||||||
|
|
||||||
void type_choice_cb(Fl_Widget *w, void *data)
|
void type_choice_cb(Fl_Widget *w, void *data)
|
||||||
{
|
{
|
||||||
G_table->type((Fl_Table_Row::TableRowSelectMode)(long)data);
|
G_table->type((Fl_Table_Row::TableRowSelectMode)(fl_intptr_t)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fl_Menu_Item tablebox_choices[] = {
|
Fl_Menu_Item tablebox_choices[] = {
|
||||||
|
|||||||
+1
-1
@@ -152,7 +152,7 @@ Fl_Tree_Item *item = tree->callback_item();
|
|||||||
if ( item ) {
|
if ( item ) {
|
||||||
fprintf(stderr, "TREE CALLBACK: label='%s' userdata=%ld reason=%s\\n",
|
fprintf(stderr, "TREE CALLBACK: label='%s' userdata=%ld reason=%s\\n",
|
||||||
item->label(),
|
item->label(),
|
||||||
(long)tree->user_data(),
|
(long)(fl_intptr_t)tree->user_data(),
|
||||||
reason_as_name(tree->callback_reason()));
|
reason_as_name(tree->callback_reason()));
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "TREE CALLBACK: reason=%s item=(no item -- probably multiple items were changed at once)\\n",
|
fprintf(stderr, "TREE CALLBACK: reason=%s item=(no item -- probably multiple items were changed at once)\\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user