I have been doing some things with FLTK on Linux lately, and now I've wondered how I can remove the title bar / undecorate the window. The target Operating System is Linux, but it would be preferrable if it runs on wayland as well as on xorg.
Asked
Active
Viewed 932 times
1
-
Please provide enough code so others can better understand or reproduce the problem. – Community May 13 '22 at 21:49
-
@Community This wouldn't be helpful as the problem isn't specific to my code, but rather to any FLTK project. – lorhof1 May 14 '22 at 12:04
-
Have a look for FLTK splash screen on the web – cup May 18 '22 at 08:03
1 Answers
0
There are two functions that can be used: border(int b)
and clear_border()
.
The border(int b)
function tells to the window manager to show or not the border: see here the documentation. This can be used during the execution.
The other useful function is clear_border()
: calling it before the Fl_Window::show()
function makes the window manager hide the border. See here the documentation.
The (simple) code below shows how to use these functions.
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
void borderHide(Fl_Widget* w, void* p){
Fl_Double_Window* win = (Fl_Double_Window*) p;
// When the input of border() is 0 it tells to the window manager to hide the border.
win->border(0);
}
void borderShow(Fl_Widget* w, void* p){
Fl_Double_Window* win = (Fl_Double_Window*) p;
// When the input of border() is nonzero it tells to the window manager to show the border.
win->border(1);
}
int main(){
Fl_Double_Window* W = new Fl_Double_Window(200, 200,"Test");
// Hide the border from the first execution.
W->clear_border();
// Button which implements the border() function for showing the border.
Fl_Button* S = new Fl_Button(80,150,100,30,"Border on");
S -> callback(borderShow,W);
// Button which implements the border() function for hiding the border.
Fl_Button* H = new Fl_Button(80,100,100,30,"Border off");
H -> callback(borderHide,W);
W->end();
W->show();
return Fl::run();
}

Eddymage
- 1,008
- 1
- 7
- 22