Giter Site home page Giter Site logo

fltk / fltk Goto Github PK

View Code? Open in Web Editor NEW
1.6K 50.0 257.0 42.6 MB

FLTK - Fast Light Tool Kit - https://github.com/fltk/fltk - cross platform GUI development

Home Page: https://www.fltk.org

License: Other

Roff 1.87% CMake 1.30% C++ 52.01% C 41.45% Makefile 0.63% Objective-C 0.12% Shell 0.65% HTML 0.10% Objective-C++ 1.85%

fltk's Introduction

README - Fast Light Tool Kit (FLTK) Version 1.4.0

WHAT IS FLTK?

The Fast Light Tool Kit is a cross-platform C++ GUI toolkit for
UNIX®/Linux® (X11 or Wayland), Microsoft® Windows®, and macOS®.
FLTK provides modern GUI functionality without the bloat and
supports 3D graphics via OpenGL® and its built-in GLUT
emulation. It was originally developed by Mr. Bill Spitzak
and is currently maintained by a small group of developers
across the world with a central repository on GitHub.

For more information see README.txt:
https://github.com/fltk/fltk/blob/master/README.txt

Build

fltk's People

Contributors

airbrett avatar barracuda156 avatar cendioossman avatar clbr avatar darealshinji avatar dejlek avatar engelsman avatar erco77 avatar fab672000 avatar fire-eggs avatar imaclmaca avatar informationsea avatar jwillikers avatar leenzhu avatar lwi avatar manolofltk avatar matthiaswm avatar michaelrsweet avatar moalyousef avatar newtonallen3 avatar nwrkbiz avatar ramcdona avatar ras0219 avatar silverduner avatar spitzak avatar taeril avatar tetsuhaut avatar tiz-huglife avatar wcout avatar zjugkc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fltk's Issues

FL_Window_Type.cxx crashes

we need to change the code to the following

// Convert A::B::C::D to D (i.e. keep only innermost name)
// This is useful for classes that contain a namespace component
static const char *trimclassname(const char *n) {
const char *nn;
if(n!='\0')
while((nn = strstr(n, "::"))) {
n = nn + 2;
}
return(n);
}

bug in gl_draw() on mac OS

There seems to be a problem in gl_draw() on mac OS only.

Unlike Windows version which uses glDrawPixels() to draw the text., the Apple version use textures which are cached into using a gl_texture_fifo class. There is a problem with this caching procedure when the text contains spaces.

The following program illustrates the problem: it correctly prints number 0 to 119 on Windows but does not on mac OS.

#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
#include <string>
#include <sstream>

class MyGlWindow : public Fl_Gl_Window {
	void draw() {
		if (!valid()) {
			valid(1);
			glClearColor(0.0, 0.0, 0.0, 0.0);
			gl_font(1, 12);
			glColor3f(1.0f, 1.0f, 1.0f);
			glDisable(GL_DEPTH_TEST);
		}
		glClear(GL_COLOR_BUFFER_BIT);
		for (int j = 0; j < 12; j++)
			for (int i = 0; i < 10; i++) {
				std::ostringstream oss;
				oss << " x " << (i + 10 * j); /// <- no bug without the " = "...
				gl_draw(oss.str().c_str(), oss.str().size(), -1.0f + 0.2f*i, -1.0f + +0.15f*j + 0.1);
			}
	}

public:
	MyGlWindow(int X, int Y, int W, int H, const char*L = 0) : Fl_Gl_Window(X, Y, W, H, L) {
	}
};

int main() {
	Fl_Window win(600, 400);
	MyGlWindow mygl(0, 0, win.w(), win.h());
	win.show();
	return(Fl::run());
}

build static and shared libs, properly named, side-by-side

I'm currently building 1.3.5 for Arch Linux and usually we require the shared libraries to be build (and not so much the static ones).
I've now achieved both by extensively renaming things within a bunch of the CMakeLists.txts, achieving an outcome with both static libs and shared libs installed with proper names (i.e. without the _SHARED postfix). Some of the macros were a little too eager to rename things ;-)

Would you be interested in a pull request for that?

PVS-studio static analyzer issues

I have already left an issue on clang-tidy. Now it's time for a more advanced tool. I have copied here only the places I personally suspect to be wrong. However, it would be much better if someone performed a full code check with this tool on a regular basis.

  1. I believe a break is missing here.

    fltk/src/Fl.cxx

    Line 1308 in 5c7118f

    window = 0;
  2. Same here
    minimal_update(mark_, position_);
  3. The 'first' local variable possesses the same name as one of the class members, which can result in a confusion.
    bool first = true; // for icon
  4. Pointer to local array 'fixpath' is stored outside the scope of this array. Such a pointer will become invalid.
    d = fixpath;
  5. Expression 'menu' on line 536 is always true as it was checked on line 530

    fltk/src/Fl_Menu.cxx

    Lines 530 to 536 in 5c7118f

    if (!menu || !menu->text) return -1;
    mx -= x();
    my -= y();
    if (my < 0 || my >= h()) return -1;
    if (!itemheight) { // menubar
    int xx = 3; int n = 0;
    const Fl_Menu_Item* m = menu ? menu->first() : 0;
  6. Why?
    mGapStart -= mGapStart - start;

    It is same to mGapStart = start but much harder to read and understand
  7. Just perfect :D
    fnt = NULL; // fl_get_font_xfld(font, size);
    if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}

    I guess it needs refactoring
  8. Condition n > 2 is always true
    if (n < 3) {
    end_line();
    return;
    }
    if (n>2) XFillPolygon(fl_display, fl_window, gc_, (XPoint*)p, n, Convex, 0);

    Same here:
    if (n < 2) {
    end_points();
    return;
    }
    if (n>1) XDrawLines(fl_display, fl_window, gc_, (XPoint*)p, n, 0);

    And here:
    gap();
    if (n < 3) {
    end_line();
    return;
    }
    if (n>2) XFillPolygon(fl_display, fl_window, gc_, (XPoint*)p, n, 0, 0);
  9. This make a lot of the following code useless
    xim_styles = NULL;
  10. The 'prop' pointer was utilized before it was verified against nullptr. The code is strange. The condition should be probably like if (*prop)

    fltk/src/Fl_x.cxx

    Lines 1202 to 1204 in 5c7118f

    if (total + num_bytes > (size_t)lower_bound) data = (uchar*)realloc(data, total + num_bytes);
    memcpy(data + total, prop, num_bytes); total += num_bytes;
    if (prop) XFree(prop);

    Same here

    fltk/src/Fl_x.cxx

    Lines 2222 to 2223 in 5c7118f

    Window child = words[0];
    if ( words ) { XFree(words); words = 0; }
  11. In this FL_Froup_Type.cxx live_widget is always tested against null pointer. However, that makes no sense as the memory was allocated with the new operator
    Fl_Group *grp = new Fl_Group(o->x(), o->y(), o->w(), o->h());
    live_widget = grp;
    if (live_widget) {

    You can find the same places inside the file on lines 355, 371, 399
  12. Nonsense
    int init = 0;

    if (!init) {

    There are a lot of warnings generated (1413). I will leave some extra comments later :)
    Thanks for working on such a great library! Have a nice day!

Integer overflow issue with large image (copy and FL_RGB_SCALING_NEAREST)

I'm working with a large JPEG image [30208 x 30208 x 3]. I have built fltk 1.3.5 in 64-bit mode using Visual Studio 2019.

In FL_Image.cxx, `Fl_RGB_Image::copy', there is an integer overflow problem that occurs with said image, when using FL_RGB_SCALING_NEAREST.

Namely, in this line:

for (dx = W, xerr = W, old_ptr = array + sy * line_d; dx > 0; dx --) {

I used ulong to fix it, as follows:

for (dx = W, xerr = W, old_ptr = array + ((ulong)sy * line_d); dx > 0; dx --) {

I see the problem still exists in the 1.4 code.

Wasm

Hello

So I've tried building fltk for wasm and it almost builds. Emscripten ships SDL so it can be chosen as a driver for fltk using -DUSE_SDL=ON when invoking cmake, however, it appears it only works for apple. The blocker is the following piece of code:

#define __APPLE__
#include <SDL2/SDL.h>
#undef __APPLE__

Which occurs in 3 files in the whole repository:
fltk/src/drivers/PicoSDL/Fl_PicoSDL_Graphics_Driver.cxx
fltk/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx
fltk/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.H
And since apple is defined, the SDL header looks for apple specific headers. Also the Fl_PicoSDL_Window_Driver calls certain protected members of Fl_Window, but that's another issue probably.

Another minor issue was the definition of U32 which isn't detected by emcmake, changing it to unsigned int works.

Are there any plans to make the SDL backend work on other platforms than Apple?

Thank you for all your work

IRC or Gitter Channel for immediate communication and queries on fltk

I think it will be great if a gitter channel or IRC is created for fltk to help in facilitating communication.
Even though there exists a google group for fltk, the response there is slow and some time not up to date, with an IRC or gitter channel communication will be almost real time and small issues can be quickly discussed.
I am open to managing the gitter channel.

editor with pango text display glitches

Editing the text file pango_editor.txt with FLTK's test/editor has two issues:

  1. The URL in line 1 (displayed as comment) is truncated (should be '.html')
  2. \n in line 5 is displayed as ¥n (Yen + 'n').

(1) ISTR that we had issues with text in italics, but I can't remember if or how it was resolved. Maybe it's still an open STR...

(2) See attached screenshot. I'm not sure if this is a pango issue though: opening the same file in the system editor xed seems to have the same issue. Inserting another character like 'x' before '\n' fixes the issue (a space does not fix it). Can anybody confirm this?

As noted in the text file, the text in question was copied from the web site mentioned in the URL in the text file.

Screenshot (web site in the background, text editor below):
pango_editor_screenshot

Fl::get_font_name() regression or change?

In older FLTK versions (1.3, 1.4 to some point) Fl::get_font_name() returns the name in eg. 'Arial bold', whereas the current version returns 'BArial' instead. This is on the same Linux machine (Ubuntu 16.04).

This can be seen with the 'fonts' program in the test folder.

Is this a regression or a deliberate change?

Request: Independent window rescale

Please consider enabling changing the size of individual windows, keeping aspect ratio and relative widget locations. We would like to use this for sight impaired people, so that without oversizing the whole application they can zoom in for individual details, then back out again.

I would suggest [ALT] + and [ALT} - for controls.

If this is not considered important enough, are there hooks in the code where we could attempt to arrange this ourselves.

This is for the Yoshimi soft-synth. We try to do as much as we can for disabled musicians.

Valgrind leak with fl_putenv changes

On Feb 10 2020 a commit with the comment "Implement fl_putenv() as cross-platform putenv()" (git 4c1b92e) changed Fl_Posix_System_Driver.H and the putenv() method to:

virtual int putenv(const char *var) {return ::putenv(strdup(var));}

Valgrind is now complaining of a memory leak at that point on my system (Gentoo Linux), probably because putenv() is not taking ownership of the string returned by strdup(). FYI.

Fluid hide widget without reason

I have a Tree widget with a Tabs inside a Tile. The Tree widget or the Tabs becomes hidden without any reason when I click on them.
This behavior is the same even when I tried older FLKT.
The code will contains o->hide();
without a reason..If you look at the property of the widget it will be checked as invisible. Even when you fix it it returns invisible.

Here is the fluid file.
/** **/

data file for the Fltk User Interface Designer (fluid)

version 1.0304
header_name {.h}
code_name {.cpp}
decl {#include <stdio.h>} {public local
}

decl {#include <stdlib.h>} {public local
}

decl {#include } {public local
}

decl {#include <FL/Fl_Group.h>} {public local
}

decl {#include <FL/Fl_Tile.h>} {public local
}

decl {#include <FL/Fl_Text_Editor.H>} {public local
}

decl {#include <FL/Fl_Text_Buffer.H>} {public local
}

decl {#include <FL/Fl_PNM_Image.h>} {public local
}

decl {#include <FL/Fl_Shared_Image.h>} {public local
}

decl {#include <FL/filename.H>} {public local
}

decl {#include <FL/Fl_Button.h>} {public local
}

decl {#include <FL/Fl_File_Chooser.H>} {public local
}

decl {#include <FL/Fl_Native_File_Chooser.H>} {public global
}

decl {#include <FL/fl_ask.H>} {public local
}

decl {#include <errno.h>} {public local
}

decl {using namespace std;} {public global
}

decl {#define INITIALREPEAT 0.5} {public global
}

decl {#define REPEAT 0.5} {public global
}

class CustomTile {: {public Fl_Tile}
} {
Function {CustomTile(int xx, int yy, int ww, int hh, const char*ll):Fl_Tile(xx,yy,ww,hh,ll)} {open
} {
code {//Constructor} {}
}
Function {resize(int x, int y, int w, int h)} {open return_type void
} {
code {this->redraw();
this->draw_children ();} {}
}
}

class Fl_Ext_Text_Editor {open : {public Fl_Text_Editor}
} {
decl {int SetNew;} {public local
}
Function {Fl_Ext_Text_Editor(int x, int y, int w, int h, charl):Fl_Text_Editor(x,y,w,h,l)} {} {
code {// constructor
Fl::add_timeout(INITIALREPEAT, blinkCursor, this);
SetNew=1;} {}
}
Function {~Fl_Ext_Text_Editor()} {} {
code {Fl::remove_timeout(blinkCursor,this);} {}
}
Function {GetCursorPosition()} {return_type int
} {
code {return mCursorPos;} {}
}
Function {blinkCursor(void
TxtObject)} {return_type {static void}
} {
code {Fl_Ext_Text_Editor tempText=(Fl_Ext_Text_Editor)(TxtObject);
tempText->SetNew=!tempText->SetNew;
tempText->show_cursor(tempText->SetNew);
Fl::repeat_timeout(REPEAT,blinkCursor, tempText);} {}
}
}

class Fl_New_File {: {public Fl_Group}
} {
decl {Fl_Ext_Text_Editor *e;} {public local
}
decl {Fl_Text_Buffer *t;} {public local
}
decl {Fl_Button b;} {public local
}
decl {int changed;} {public local
}
decl {static int counter;} {public local
}
decl {char fileName[4056];} {public local
}
decl {Fl_New_File pNext;} {public local
}
decl {Fl_New_File pPrev;} {public local
}
decl {int NotSaved; // 1 true 0 false} {public local
}
Function {Fl_New_File(int x, int y, int w, int h, char
l):Fl_Group(x,y,w,h,l)} {} {
code {// Class constructor for the text editor part.
begin();
changed=1; // Modified
NotSaved=1; //Not saved
snprintf(fileName,strlen(l)+1,"%s",l);
e=new Fl_Ext_Text_Editor(x,y+10,w,h,"");
t=new Fl_Text_Buffer;
b=new Fl_Button(x+w-15,y,10,10,"x");
b->callback((Fl_Callback
)cb_File_Close);
t->text("REM Script Program");
e->buffer(t);
pNext=0; // No next object yet.
pPrev=0; // it is the first object
box(FL_THIN_UP_BOX);
color(FL_BACKGROUND_COLOR);
selection_color(FL_BACKGROUND_COLOR);
labeltype(FL_NORMAL_LABEL);
labelfont(0);
labelsize(9);
labelcolor(FL_BLACK);
align(FL_ALIGN_TOP);
when(FL_WHEN_RELEASE);
end();} {}
}
Function {~Fl_New_File()} {} {
code {/

destructor
*/} {}
}
}

Function {Style_Color_determine(int pos, // I - Position of update
int nInserted, // I - Number of inserted chars
int nDeleted, // I - Number of deleted chars
int /nRestyled/, // I - Number of restyled chars
const char * /deletedText/,// I - Text that was deleted
void *cbArg)} {return_type void
} {
code {//Style function .. this should be implimented... later} {}
}

Function {load_file(char *newfile)} {return_type void
} {
code {// this should be modified ... it is from Editor

txt_Tab_Edit->begin();
char justFileName[30];
char*scancp=newfile;
int scanp= strlen(newfile)-1;
char OLDjustFileName[30];
snprintf(OLDjustFileName,1, "%c", '\0');
snprintf(justFileName,1, "%c", '\0');
char tempChar;
while (((int)(scancp[scanp])!=0x2f)&&((int)(scancp[scanp])!=0x5c)) // 0x2f= /
{

   tempChar=scancp[scanp];
   strcpy(OLDjustFileName,justFileName);
   if (!(strlen(OLDjustFileName)==0))
   {

      snprintf(justFileName,strlen(OLDjustFileName)+2, "%c%s", tempChar,OLDjustFileName);
   }
   else
   {
     snprintf(justFileName,2, "%c", tempChar);
   }
   scanp=scanp-1;
  }

char buf[30];
snprintf(buf,30,"%s",justFileName);
Fl_New_File *st=new Fl_New_File(230,125,1050,840,"");
st->copy_label(buf);
//snprintf(st->fileName, strlen(newfile),"%s",newfile); // save file name
strcpy(st->fileName, newfile); // save file name

int r;
r = st->t->loadfile(newfile);
if (r)
{
if (strlen(newfile)==0)
return;
else
fl_alert("Error reading from file \'%s\':\n%s.", newfile, strerror(errno));
}

else
st->NotSaved=0; // Not saved
Fl_New_File::counter++;
st->t->call_modify_callbacks();
txt_Tab_Edit->end();
txt_Tab_Edit->redraw();} {}
}

decl {int Fl_New_File::counter=1;} {private global
}

Function {} {open return_type int
} {
Fl_Window frmMainWindow {open
xywh {1920 31 1920 1017} type Double hide resizable
} {
Fl_Menu_Bar Editor_Meny_File {
xywh {0 0 1920 25} box FLAT_BOX down_box THIN_UP_BOX color 7 labelsize 12
} {
Submenu mnu_File {
label { &File}
xywh {15 15 100 40} labelsize 12
} {
MenuItem mnu_New {
label {&New}
callback {cb_File_New();}
xywh {20 20 100 40} shortcut 0x4006e labelsize 12
}
MenuItem mnu_Open {
label {&Open}
callback {cb_File_Open();}
xywh {30 30 100 40} shortcut 0x4006f labelsize 12
}
Submenu mnu_History {
label {&History}
xywh {5 5 100 20} labelsize 12 divider
} {
MenuItem mnu_ClearHistory {
label {Clear History}
xywh {5 5 100 20} labelsize 12 deactivate
}
}
MenuItem mnu_Save {
label {&Save}
callback {cb_File_Save("");// this should be fixed .. you should send the name of the file which should be saved.}
xywh {45 65 100 40} shortcut 0x40073 labelsize 12
}
MenuItem mnu_SaveAs {
label {S&ave As}
callback {cb_File_SaveAs();}
xywh {45 55 100 40} shortcut 0xc0073 labelsize 12
}
MenuItem mnu_SaveAsLinux {
label {Save as Linux format}
xywh {20 20 100 20} labelsize 12
}
MenuItem mnu_SaveAll {
label {Save A&ll}
xywh {20 20 100 20} labelsize 12
}
MenuItem mnu_Close {
label {&Close}
callback {cb_File_Close();}
xywh {50 85 100 40} shortcut 0x4ffc1 labelsize 12
}
MenuItem mnu_Exit {
label {&Exit}
callback {exit(0);}
xywh {20 20 100 20} labelsize 12
}
}
Submenu mnu_Edit {
label { &Edit}
xywh {30 30 100 40} labelsize 12
} {
MenuItem mnu_Undo {
label {&Undo}
xywh {35 35 100 40} shortcut 0x4007a labelsize 12
}
MenuItem mnu_Redo {
label {&Redo}
xywh {45 80 100 40} shortcut 0x40079 labelsize 12
}
MenuItem mnu_Cut {
label {C&ut}
xywh {40 40 100 40} shortcut 0x40078 labelsize 12
}
MenuItem mnu_Copy {
label {&Copy}
xywh {30 30 100 20} shortcut 0x40063 labelsize 12
}
MenuItem mnu_Paste {
label {&Paste}
xywh {30 30 100 20} shortcut 0x40076 labelsize 12
}
MenuItem mnu_Delete {
label {&Delete}
xywh {55 75 100 40} labelsize 12
}
MenuItem mnu_SelectAll {
label {Select All}
xywh {55 65 100 40} shortcut 0x40061 labelsize 12
}
MenuItem mnu_Find {
label {&Find}
xywh {60 95 100 40} shortcut 0x40066 labelsize 12
}
MenuItem mnu_FindNext {
label {&Find Next}
xywh {30 30 100 20} shortcut 0xffc0 labelsize 12
}
MenuItem mnu_Replace {
label {&Replace}
xywh {70 105 100 40} shortcut 0x40068 labelsize 12
}
MenuItem mnu_Goto {
label {&Goto}
xywh {80 115 100 40} shortcut 0x40067 labelsize 12
}
}
Submenu mnu_Add {
label { &Add}
xywh {25 25 100 40} labelsize 12
} {
MenuItem mnu_NewInst {
label {&Instruction}
callback {cb_Add_Instruction();}
xywh {30 30 100 40} shortcut 0x4006e labelsize 12
}
MenuItem mnu_OpenInstruction {
label {&Open}
callback {cb_Add_OpenInstruction();}
xywh {40 40 100 40} shortcut 0x4006f labelsize 12
}
MenuItem mnu_Add_InsertInstruction {
label {&Insert Instruction}
callback {cb_Add_InsertInstruction();}
xywh {55 65 100 40} shortcut 0xc0073 labelsize 12
}
MenuItem mnu_Add_Cut {
label {&Cut Instruction}
callback {cb_Add_Cut_Instruction();}
xywh {60 95 100 40} shortcut 0x4ffc1 labelsize 12
}
MenuItem mnu_Add_Delete {
label {&Delete Instruction}
callback {cb_Add_Delete_Instruction();}
xywh {55 75 100 40} shortcut 0x40073 labelsize 12
}
MenuItem mnu_Add_Duplicate {
label {&Duplicate}
callback {cb_Add_Duplicate();}
xywh {30 30 100 20} labelsize 12
}
}
Submenu {} {
label Tools
xywh {15 15 100 20} labelsize 12
} {
MenuItem mnu_ToolsDebuger {
label Debuger
xywh {15 15 100 20} shortcut 0xffbe labelsize 12
}
MenuItem mnu_Options {
label {&Options}
callback {cb_Options();}
xywh {25 25 100 20} labelsize 12
}
MenuItem mnu_ToolsTableAssistant {
label {Table Assistant}
xywh {35 35 100 20} labelsize 12
}
}
Submenu {} {
label {&Help}
xywh {10 10 100 20} labelsize 12
} {
MenuItem {} {
label Help
xywh {10 10 100 20} shortcut 0xffbe labelsize 12
}
MenuItem {} {
label Examples
xywh {20 20 100 20} labelsize 12
}
MenuItem {} {
label About
callback {Getabout();}
xywh {30 30 100 20} labelsize 12
}
}
}
Fl_Menu_Bar {} {open
xywh {0 25 1920 27}
} {}
Fl_Group {} {
xywh {-1 26 635 25}
} {
Fl_Button btn_File_New {
callback {cb_File_New();}
tooltip New image {icons/button.new.gif} xywh {-1 26 25 24} box THIN_UP_BOX shortcut 0x4006e
code0 {o->clear_visible_focus();}
}
Fl_Button btn_File_Open {
callback {cb_File_Open();}
tooltip Open image {icons/fileopen.xpm} xywh {24 26 25 25} box THIN_UP_BOX shortcut 0x4006f
code0 {o->clear_visible_focus();}
}
Fl_Button btn_File_Close {
callback {cb_File_Close();}
tooltip Close image {icons/fileclose.png} xywh {49 26 25 25} box THIN_UP_BOX down_box THIN_DOWN_BOX shortcut 0x4ffc1 align 16
code0 {o->clear_visible_focus();}
}
Fl_Button btn_File_Save {
callback {cb_File_Save("");// this should be fixed .. you should send the name of the file which should be saved.}
tooltip Save image {icons/filesave.xpm} xywh {74 26 25 25} box THIN_UP_BOX shortcut 0x40073
code0 {o->clear_visible_focus();}
}
Fl_Button btn_File_SaveAll {
callback {cb_File_SaveAll();}
tooltip {Save All} image {icons/filesaveAll.xpm} xywh {99 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_File_Backup {
callback {cb_File_Backup();}
tooltip Backup image {icons/zip.gif} xywh {124 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Edit_Cut {
callback {cb_Edit_Cut();}
tooltip Cut image {icons/cut.xpm} xywh {153 26 25 25} box THIN_UP_BOX shortcut 0x40078
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Edit_Copy {
callback {cb_Edit_Copy();}
tooltip Copy image {icons/copy.xpm} xywh {178 26 25 25} box THIN_UP_BOX shortcut 0x40063
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Edit_Paste {
callback {cb_Edit_Paste();}
tooltip Paste image {icons/button.pastetext.xpm} xywh {203 26 25 25} box THIN_UP_BOX shortcut 0x40076
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Edit_Undo {
callback {cb_Edit_Undo();}
tooltip Undo image {icons/button.undo.xpm} xywh {231 26 25 25} box THIN_UP_BOX shortcut 0x4007a
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Edit_Redo {
callback {cb_Edit_Redo();}
tooltip Redo image {icons/button.redo.xpm} xywh {256 26 25 25} box THIN_UP_BOX shortcut 0x40079
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_Hyperlink {
tooltip Hyperlink image {icons/www.xpm} xywh {286 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_EmailAddress {
tooltip {Email adress} image {icons/mail_generic.png} xywh {311 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_Anchor {
tooltip Link image {icons/button.anchor.xpm} xywh {336 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_HLine {
label {---}
tooltip {Horizental line} xywh {361 26 25 25} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelsize 18 align 17
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_Picture {
tooltip {Insert image} image {icons/button.image.xpm} xywh {386 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_HomeAdress {
tooltip {Home Page(Yours)} image {icons/gohome.png} xywh {415 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_EmailCust {
tooltip {Email adress (yours)} image {icons/button.mail.xpm} xywh {441 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_Insert_Favorite {
tooltip {Home page from your favorite url} image {icons/bookmark_folder.png} xywh {466 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
Fl_Button btn_File_Preview {
callback {cb_File_Preview();}
tooltip {Home page from your favorite url} image {icons/bookmark_folder.png} xywh {492 26 25 25} box THIN_UP_BOX
code0 {o->clear_visible_focus();}
}
}
Fl_Wizard {} {
label tile_Main open
xywh {0 73 1945 939}
class CustomTile
} {
Fl_Tree root_InstructionSequences {
label {Instruction List}
callback {cb_changeStepDetails();} selected
xywh {0 73 200 936} labelsize 10 align 2
}
Fl_Tabs tab_Step_Details {
xywh {200 73 1750 937} align 5 hide
} {
Fl_Group {} {
label StepDetails
xywh {210 108 1706 408} align 5 hide resizable
} {
Fl_Input_Choice {} {
label {Arg 1} open
xywh {258 123 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 3} open
xywh {258 155 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 5} open
xywh {258 187 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 7} open
xywh {258 220 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 9} open
xywh {258 254 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg11 open
xywh {258 287 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg13 open
xywh {258 319 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg15 open
xywh {258 352 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg17 open
xywh {258 384 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg19 open
xywh {258 417 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg21 open
xywh {258 449 542 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg23 open
xywh {258 482 542 29} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 2} open
xywh {1071 123 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 4} open
xywh {1071 155 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 6} open
xywh {1071 187 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label {Arg 8} open
xywh {1071 220 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg10 open
xywh {1071 254 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg12 open
xywh {1071 287 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg14 open
xywh {1071 319 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg16 open
xywh {1071 352 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg18 open
xywh {1071 384 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg20 open
xywh {1071 417 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg22 open
xywh {1071 449 572 30} labeltype ENGRAVED_LABEL
} {}
Fl_Input_Choice {} {
label Arg24 open
xywh {1071 482 572 29} labeltype ENGRAVED_LABEL
} {}
}
Fl_Group txt_Tab_Edit {
label Editor open
xywh {199 108 1750 935} align 5
} {
Fl_Wizard txtEditorTemplate {
label { } open
xywh {199 108 1720 929} labelsize 9 align 5
class Fl_New_File
} {}
}
}
}
}
}

Function {Getabout()} {return_type void
} {
Fl_Window frmAbout {
label {FLTK Editor - About}
xywh {933 635 472 221} type Double hide modal
} {
Fl_Button {} {
label OK
callback {frmAbout->hide();}
xywh {400 185 60 25} box THIN_UP_BOX down_box THIN_DOWN_BOX labeltype EMBOSSED_LABEL
}
Fl_Box {} {
label {ScriptEditor Scanfil Vellinge AB}
xywh {40 30 373 126} box PLASTIC_UP_FRAME labeltype ENGRAVED_LABEL labelfont 9 labelsize 43 align 128
}
Fl_Box {} {
label {Powered by: FLTK GUI}
xywh {15 194 105 16} labelfont 2 labelsize 9 deactivate
}
}
code {frmAbout->show();} {}
}

Function {cb_File_Open()} {return_type void
} {
code {// Open a file
char filename[256] = "";
char newfile = fl_file_chooser("DAT Files (.dat)\tImage Files (.{dad})", ".*", filename);
if (newfile != NULL){
strcpy(filename,newfile);
load_file(filename);
}} {}
}

Function {cb_File_New()} {return_type void
} {
code {// New Tab widget whould be made when you click New button.
txt_Tab_Edit->begin();
char buf[30];
snprintf(buf, sizeof(Fl_New_File::counter)+10 ,"Untitiled %d",Fl_New_File::counter);
Fl_New_File *st=new Fl_New_File(230,125,1050,840,"");

st->NotSaved=1; // Not saved
st->copy_label(buf);
strcpy(st->fileName,buf);
Fl_New_File::counter++;
txt_Tab_Edit->end();
txt_Tab_Edit->redraw();
return;} {}
}

Function {check_save(void)} {return_type int
} {
code {return 1;} {}
}

Function {cb_File_Close()} {return_type void
} {
code {//Close file ... Before that we should check if it is saved
//write the code for this function
return;} {}
}

Function {cb_File_Save(char* newfile)} {return_type void
} {
code {} {}
}

Function {cb_File_SaveAll()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_File_Backup()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_Edit_Cut()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_Edit_Paste()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_Edit_Undo()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_Edit_Redo()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_Edit_Copy()} {return_type void
} {
code {/*
not implemented
*/} {}
}

Function {cb_FontBrowser(Fl_Widget*, void* frm_FontBrowser)} {return_type void
} {
code {} {}
}

Function {cb_Options()} {return_type void
} {
Fl_Window {} {open
xywh {317 388 625 484} type Double hide
} {
Fl_Tabs {} {open
xywh {5 59 595 397}
} {
Fl_Group {} {
label General open
xywh {25 78 574 370}
} {
Fl_Group {} {open
xywh {50 100 252 106} box BORDER_BOX
} {
Fl_File_Browser {} {
xywh {65 115 210 30}
}
}
}
Fl_Group {} {
label Editing open
xywh {25 78 574 370} hide
} {}
}
}
}

Function {cb_changeStepDetails()} {return_type void
} {
code {// Show the current steps's data.} {}
}

Function {cb_File_SaveAs()} {return_type void
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_Add_Instruction()} {open
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_Add_OpenInstruction()} {open
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_Add_InsertInstruction()} {open
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_Add_Delete_Instruction()} {open
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_Add_Cut_Instruction()} {open
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_Add_Duplicate()} {open
} {
code {printf("Hello, World!\n");} {}
}

Function {cb_File_Preview()} {open
} {
code {printf("Hello, World!\n");} {}
}

FLTK breaks when resize request is denied

I think resize handling in FLTK is unfortunately in need of an overhaul. I've run in to the following scenario:

  1. Create window
  2. Maximize window
  3. Call resize(...) on window

At this point the window stops updating.

The direct reason is because wait_for_expose has been set when doing the resize(...). However it never gets any WM_PAINT since Windows didn't allow me to do this resize. I can also see that FLTK's view of width and height is out of sync.

This is Win32, but I'm fairly sure I've seen issues like this on the other platforms as well. I think there is a fundamental mis-design with the resizing where we need to separate requests from the window actually being resized. We cannot blindly assume that the window manager will honour our request, as evident here.

(This was tested with 1.3.5, but I had a look at master and the same logic seemed to be in place there, so I'm going to assume the bug remains)

How to edit source

Hello
i want to edit simple thing in source code for learning source

i want to change check-button tick sign to other shape. how to do this?

Transfer issue tickets?

Hello!

For quite a while, I had tried to maintain an svn-to-git mirror of FLTK: https://github.com/IngwiePhoenix/FLTK - BUT... git-svn stopped doing what it is supposed to, and keeps throwing "Checksum missmatch" messages at me each time I try to fetch. Let alone rebase...

But, there happen to be issue and PR tickets on this repo, that I'd like to point towards:

And this PR:

I would like to close my mirror, seeing as there is an official repository now. Thank you for making FLTK - and finally an official FLTK repo... :)

macOS OpenGL + tooltips

Hi @ManoloFLTK,

The current master (38cf195) behaves in a weird way on macOS when tooltips are drawn on top of OpenGL windows. To reproduce, apply the following one-liner to test/cube.cxx:

--- a/test/cube.cxx
+++ b/test/cube.cxx
@@ -148,6 +148,7 @@ void makeform(const char *name) {
   if (Fl::cfg_gfx_opengl) { // try to overlay a button onto an OpenGL window
     cube->begin();
     Fl_Button *test = new Fl_Button(35, 105, 100, 30, "Test");
+    test->tooltip("Test tooltip");
     test->box(FL_ROUND_UP_BOX);
     cube->end();
   }

Hovering several times over the button has the tooltip moving around the screen.

SSE/AVX support

Hello. I've been working around the project for a while and it's really nice.
However, I didn't find out if it has explicit support for modern vector instructions like Intel AVX or arm NEON. I am not sure if it helps to improve rendering speed, but I would really appreciate if you provide some estimations:

  1. Does FLTK need it at all?
  2. What is the actual state of supporting it?
  3. Could such extentions be merged into master if proper built flags are provided with PR?
  4. What parts of FLTK are "bottle necks" in terms of performance? Any estimations of the possible benefit of optimizing it?
    I am really eager to find a proper project for optimizing with AVX as it is a part of task I have in my university :) Any ideas are appreciated. Have a nice day!

GCC flips on realloc range

Recent versions of GCC appear to throw a range(?) warning on a particular call to realloc in the library. The line in question is:

arr = (char*)realloc(arr, count * sizeof(char));

From src/Fl_Table_Row.cxx

It appears to be from the fact that GCC cannot guarantee count is always positive (ml).

The warning seems to go away with an unsigned cast:

arr = (char*)realloc(arr, (unsigned)count * sizeof(char));

Wasm Support, SDL Driver

I want to try compiling a FLTK app to Wasm, so I'm making this request. I tried to build FLTK with LLVM before but had no luck. I hope the FLTK developers will at least consider this (if they haven't been already). Thanks in advance.

Use Private Use Area for FL_Button and FL_key... constants

As indicated by the comment in Enumerations.H:

// FIXME: These codes collide with valid Unicode keys

Might be a good idea to make this optional so people don't accidentally break their programs?

Kinda like this maybe:

#ifdef SOMETHING_SOMETHING_PUA
#define FL_Button 0xE000
#else
#define FL_Button 0xFEE8
#endif

Bogus FL_MOVE/FL_DRAG events

We've unfortunately found an issue where this code will result in bogus FL_MOVE/FL_DRAG events being sent:

fltk/src/Fl_x.cxx

Lines 221 to 224 in f386bd2

else if (send_motion == fl_xmousewin) {
send_motion = 0;
Fl::handle(FL_MOVE, fl_xmousewin);
}

What happens is that we get a Leave which sets fl_xmousewin to NULL. Any X11 event after that will cause the above code to be run as send_motion will also be NULL.

I suspect the issue is simply that an extra NULL check is needed as I assume this code was only meant to be run if there was an actual window to send things to.

Request for 3d charts and more extensive 2d charts (e.g., radial plots)

It is very hard to find anything out there for 3d or more extensive 2d FLTK charts that is not also GPL or Python-ish (e.g., matplotlib). It would be tremendous if FLTK could be improved in this area, especially for use in scientific / engineering applications. I do understand that the "Light" in FLTK may be challenged by such changes, but perhaps a compromise could be implemented. Anyway, I just wanted to say I am learnng FLTK and I really like it, but I am someone who needs good chart support for my applications. I do really appreciate the Fl_Chart class, but could the FLTK development team put some of these improvements into the 1.4.x roadmap?

Feature suggestion: read on-screen pixel

There exists the fl_point() function to draw a pixel but no function to read a pixel value back. However, such function would make it possible to create alpha-blended drawing functions. Hence, this feature suggestion.

Examples are not installed (but their man pages are)

The blocks, checkers and sudoku examples are being built automatically using the cmake setup, their man pages are installed using make install, but not the applications themselves, neither their XDG and icon integration.

unexpected behavior when using Fl::use_high_res_GL(false)

My application contains an Fl_Gl_Window with custom drawing code in the draw() method. I have left Fl::use_high_res_GL() as disabled since updating the code to use pixel_w() and pixel_h() everywhere would be a big burden, especially because I cannot test it myself on MacOS -- the binary is compiled by a 3rd party.

So what is happening is that on a retina display, the Fl_Gl_Window is being drawn in only the bottom left quarter of the full size. I suspect the reason is that glViewport() needs to be called with the "true" window size and not the w() and h() size.

Can somebody confirm if that is what the problem is, or could it be something else?

Make test/checkers HighDPI friendly

The piece images used by the test/checkers app are 62x62 pixels by size
and are drawn at 62x62 FLTK drawing units. While that's optimal for 96 DPI
displays, HighDPI systems are such that there is more than 1 pixel per
FLTK drawing unit. Larger piece images are necessary to have pieces optimally
drawn on HighDPI displays.

For example, on a macintosh with retina display, the checkers pieces are currently drawn
by blocks of 4 identically colored pixels.

If it was possible to construct twice larger images (that is, 124x124 instead of the present
62x62 for each piece image), that extra line in the source code would be enough
to get well-drawn pieces on HighDPI displays:
for (int i = 0; i < which; i++) png[i]->scale(png[i]->data_w()/2, png[i]->data_h()/2);
after line #880 of file test/checkers.cxx . That source code change would be
equally effective under X11, Windows and macOS.

That would also show the use of the new
Fl_Image::scale(int, int)
member function to improve support of HighDPI displays.

Fl_Tree doesn't spawn FL_TREE_REASON_RESELECTED

I built from source, everything else works fine. Not sure what other info I can give here - the event just never arrives at the handler, the others (SELECT & DESELECT for example) work fine.

Provide shared libraries with fltk-config

The fltk-config tool should provide the path to libfltk.so to be able to build against the shared libraries.
Alternatively it would be very benificial to provide pkgconfig integration.

Uninitialized variables in calls to fl_clip_box()

As pointed out by @shlyakpavel in issue #5 static code analyzers (e.g. clang-tidy) show "uninitialized variable" warnings for code like this:

int X, Y, W, H; fl_clip_box(0, 0, w(), h(), X, Y, W, H);

although this code is usually correct because X, Y, W, H are reference arguments that return values.

All such occurrences should be checked and used variables should be initialized properly.

Option: We should also consider using an Fl_Rect object instead of X, Y, W, H in a new overloaded version of fl_clip_box().

How to find Zlib installation when generating project files with CMake

I have Zlib installed in my C drive root. When I try to use CMake to generate project files for FLTK, it can't find Zlib. How do I specify the library name and path? I've tried this: cmake -G "Visual Studio 16 2019" -A x64 -Thost=x64 .. -DCMAKE_INSTALL_PREFIX="C:/Program Files/FLTK" -DCMAKE_BUILD_TYPE=Release -DZLIB_INCLUDE_DIR=C:/zlib/include -DZLIB_LIBRARY=C:/zlib/lib (I see I won't have to specify the install prefix, so when I run it again I won't include that) and I get a warning saying that the unknown manually-specified option ZLIB_LIBRARY wasn't used. What's the correct way to specify the library path (and name, which in my case is zlibstatic.lib (if I use zlib.lib, it'll try to use zlib.dll as well and that's bad as it'll cause linker errors due to symbols being seen in more than one place))? Thanks in advance.

Edit: Note: I didn't install the LLVM toolchain extension since it only seems to work if VS2017 is also installed. On the extension's installation page it says that VS2019 users may want to look at this instead. I'm using the built-in LLVM toolchain that VS2019 comes with instead of the extension. CMake must be trying to find the extension. I need to know how, if at all, I can get it to use the built-in LLVM toolchain instead.

Fl_Help_View: enable copying text selection in subclass

I made a subclass of Fl_Help_View() and added a context menu with the option to copy the currently selected text:

class MyHelpView : public Fl_Help_View
{
private:
  Fl_Menu_Item *_menu;

public:
  MyHelpView(int X, int Y, int W, int H);
  void menu(Fl_Menu_Item *m) { _menu = m; }
  int is_selected() { return selected; }
  Fl_Help_View *has_current_view() { return current_view; }
  void copy_selection() { end_selection(1); }

protected:
  int handle(int event);
};

int MyHelpView::handle(int event)
{
  if (event == FL_PUSH && Fl::event_button() == FL_RIGHT_MOUSE) {
    _menu[0].flags = (is_selected() && has_current_view() == this) ? FL_MENU_DIVIDER : FL_MENU_INACTIVE|FL_MENU_DIVIDER;

    const Fl_Menu_Item *m = _menu->popup(Fl::event_x(), Fl::event_y());
    if (m) {
      m->do_callback(NULL);
      return 1;
    }
  }
  return Fl_Help_View::handle(event);
}

static void copy_html_selection_cb(Fl_Widget *, void *) {
  html->copy_selection();
}

static void do_nothing_cb(Fl_Widget *, void *) {
}

Fl_Menu_Item html_menu[] = {
  { " Copy selection  ", 0, copy_html_selection_cb, NULL, FL_MENU_DIVIDER },
  { " Dismiss  ", 0, do_nothing_cb },
  {0}
};

html = new MyHelpView(10, 10, 780, 580);
html->menu(html_menu);

But in order to do that I had to edit the Fl_Help_View.H header file:

--- a/FL/Fl_Help_View.H
+++ b/FL/Fl_Help_View.H
@@ -240,12 +240,16 @@ class FL_EXPORT Fl_Help_View : public Fl_Group {	// Help viewer widget
   static int    selection_push_last;
   static int    selection_drag_first;
   static int    selection_drag_last;
+protected:
   static int    selected;
+private:
   static int    draw_mode;
   static int    mouse_x;
   static int    mouse_y;
   static int    current_pos;
+protected:
   static Fl_Help_View *current_view;
+private:
   static Fl_Color hv_selection_color;
   static Fl_Color hv_selection_text_color;
 
@@ -286,7 +290,9 @@ private:
   void          hv_draw(const char *t, int x, int y, int entity_extra_length = 0);
   char          begin_selection();
   char          extend_selection();
+protected:
   void          end_selection(int c=0);
+private:
   void          clear_global_selection();
   Fl_Help_Link  *find_link(int, int);
   void          follow_link(Fl_Help_Link*);

To achieve the same on Fl_Text_Display() I don't need to patch anything.

Enable more g++ warning flags

I was wondering if it would be appreciated if there was an effort to add some warning flags (eg: -Wswitch-enum, and more).

I'm willing to do some work to resolve some of these flags; let me know!

Fl_Bitmap disappears randomly

On Ubuntu 16.04, the issue can be reproduced in both the checkers and bitmap test apps. Checkers is unplayable. Occasionally, fragments of a piece will appear if you drag the mouse around the board, but for the most part, the pieces are invisible. In the bitmap app, the sorceress is initially visible, but disappears as soon as one of the buttons is clicked. Occasionally, I can get it to reappear by resizing the window. The problem doesn't seem to affect (e.g.) Fl_PNG_Image: I replaced the checkers piece bitmap with a png and the display issue went away.

Static analyzer issues

Hello. Have been walking around X11 driver with clang-tidy. I'll comment only the places I suppose to have mistakes
The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage https://github.com/fltk/fltk/blob/master/src/drivers/X11/Fl_X11_Screen_Driver.cxx#L971
Ints are used without initialization here. Looks weird. https://github.com/fltk/fltk/blob/master/src/drivers/X11/Fl_X11_Window_Driver.cxx#L237
P is initialized but never used. It is probably not a bug, but still suspicious. https://github.com/fltk/fltk/blob/master/src/drivers/X11/Fl_X11_Screen_Driver.cxx#L1241
In general, the whole project should be reviewed with a static analyzer as there are 572 problems found with only strict options applied. I guess it is so for the long FLTK history, but still...

Ability to flip and turn Fl_(RGB_)Images

I would be interesting if there was a simple way to do horizontal and vertical flips on images and to turn them 90° to the left or right. This could for example be used to modify images of arrows. In theory it's just copying pixels in a different order, but I'm having my issues implementing such a thing.

Loading PNG_IMAGe failed

$ fltk-config --ldflags --compile hallo_test.cxx

g++ -I. -I./png -I./zlib -I./jpeg -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -o 'hallo_test' 'hallo_test.cxx' -static ./lib/libfltk.a -lole32 -lws2_32 -lcomctl32 -luuid
D:\Tmp\ccw4NMb9.o:hallo_test.cxx:(.text+0xe8): undefined reference to `Fl_PNG_Image::Fl_PNG_Image(char const*)'
collect2.exe: error: ld returned 1 exit status

What do I have to change in the fltk-config?

How to build fltk on Dev-C++

I don't know how to build it on Dev-C++. And I searched forums found there is a way to download devpack from fltk.net, but the site address is wrong. Could you help me to solve this problem?

usage in plugins on Linux

(sigh, fat fingered the Enter key)

I'd like some advice about thread support. The documentation says Fl::lock() must be called in the first thread somewhere under main(), but LV2 audio plugins (at least) can do no such thing-- main() naturally belongs to the plugin hosts.

If the lock isn't initialized before some part of the plugin tries to interact with the UI, we get a few junk bytes which appear in the terminal (when the host was launched from there). I first saw this when the lock in standalone Yoshimi wasn't being initialized "early enough". In fact, it wasn't being done in main() at all, so I moved it there, and the junk went away. Later someone wanted it moved it back to Yoshimi's separate UI thread in order to prevent crashing on a musl libc system, which was probably a musl problem anyway. But in this case the junk bytes didn't reappear, so I guess we just (apparently) kept on winning a race, somehow. Thinking about it is unpleasant.

Later still, I noticed that Qtractor gives the same symptom upon loading the Yoshimi LV2 plugin. I seemed to be able to work around the requirement by calling Fl::lock() in the plugin's ::instantiate() method so that before it attempted to create a UI, things would be "safe". But I'm not certain.

Is there an unofficial way to do this? What's the Right Thing™?

Under certain circumstances, resize() ignored on MacOSX (1.4.x)

It seems if one does these steps in a Mac application with 1.4.x, the resize() step has no effect:

  1. Create a window with an X,Y,W,H
  2. Create some child widgets (optional)
  3. Call window->resize();
  4. Call window->show();
  5. Fl::run();

Here, step 3's new width+height values are ignored.
(size()'s width/height values are also ignored)

This is specific on Mac OSX (tested on 10.10.5), didn't try others yet.

Apparently to replicate it's important an X,Y,W,H value are specified when creating the window,
and resize()/size() must be called BEFORE show(). Changing either of those things makes it work OK.

Attached program can be built with 'fltk-config --compile resize.cpp' on the Mac to demonstrate the problem; window shows as a tiny size (25,25) instead of (380,180).
resize.zip

Feature suggestion: functions to read BMP and GIF images from array

While the constructors for Fl_JPEG_Image and Fl_PNG_Image helpfully allow the developer to load the image data from an array, there is no similar functionality for Fl_GIF_Image and Fl_BMP_Image.

This functionality would be useful in cases where, for example, the image you want to load is actually part of an archive that's dealt with by a third-party library like libzip, or an even simpler case of the image being compiled into a constant array in the program's source code.

Multihead fullscreen broken on macOS

It was overlooked in 39bb0bf which blindly uses the current screen and doesn't respect Fl_Window::fullscreen_screen_top and friends:

Issue observed with FLTK 1.3.5, but remains on master.

Easily break Fl_Tree::insert

Fl_Tree::insert doesn't check the pos if it is not out of scope ... You can pass any number to the function and for sure it will crashes since it will point to a position that doesn't exist
Use this code to break the Fl_Tree

/** sample code modified*/
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
/*
int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(340,180);
Fl_Box box = new Fl_Box(20,40,300,100,"Hello, World!");
box->box(FL_UP_BOX);
box->labelfont(FL_BOLD+FL_ITALIC);
box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
return Fl::run();
}
/

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Tree.H>
int main(int argc, char *argv[]) {
Fl_Double_Window *win = new Fl_Double_Window(250, 400, "Simple Tree");
win->begin();
{
// Create the tree
Fl_Tree *tree = new Fl_Tree(10, 10, win->w() - 20, win->h() - 20);
tree->showroot(0);

	// Add some items
	tree->add("Aaa/000");
	tree->add("Aaa/111");
	tree->add("Aaa/222");
	tree->add("Aaa/333");
	tree->add("Aaa/444");
	tree->add("Aaa/555");

	tree->add("Bbb/000");
	tree->add("Bbb/111");
	tree->add("Bbb/222");
	tree->add("Bbb/333");
	tree->add("Bbb/444");
	tree->add("Bbb/555");

	// Let's use Fl_Tree::insert() to put an item between Aaa/333 and Aaa/444
	{
		Fl_Tree_Item *item_Aaa = tree->find_item("Aaa");        // get the parent /Aaa item

/* if (item_Aaa) tree->insert(item_Aaa, "New item",8); // insert into index #4 Uncomment this to find the bug. You cannot give the function position 8 since it doesn't exist - Mariwan Jalal*/
}

	// Let's use Fl_Tree::insert_above() to put an item between Bbb/333 and Bbb/444
	{
		Fl_Tree_Item *item_444 = tree->find_item("Bbb/444");    // get item Bbb/444
		if (item_444) tree->insert_above(item_444, "New item");// insert above it
	}
}
win->end();
win->resizable(win);
win->show(argc, argv);
return(Fl::run());

}

Build instructions for Unix seem out of date

README_Unix.txt has not been updated a while. It does not even mention FLTK 1.4 ;)

Especially it would be interesting what to do, after cloning from github.
Typing 'make' works out of the box normally, but what to do, if configuration is needed before?

NOCONFIGURE=1 ./autogen.sh, as stated in README_Unix.txt seems to work (at least a configure script is generated), but the output is somewhat confusing:

configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found.
configure.ac: You should verify that configure.ac invokes AM_INIT_AUTOMAKE,
configure.ac: that aclocal.m4 is present in the top-level directory,
configure.ac: and that aclocal.m4 was recently regenerated (using aclocal)
configure.ac:28: installing './config.guess'
configure.ac:28: installing './config.sub'
automake: error: no 'Makefile.am' found for any configure output

Is this still the recommended way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.