如何删除Linux上FLTK中的标题栏 /未加工的窗口?

发布于 2025-01-29 06:39:14 字数 96 浏览 2 评论 0原文

最近,我最近在Linux上使用FLTK做了一些事情,现在我想知道如何删除标题栏 /未修复的窗口。目标操作系统是Linux,但是如果它在Wayland和Xorg上运行,则可以优选。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愚人国度 2025-02-05 06:39:14

可以使用两个功能:border(int b)clear_border()

border(int b)函数告诉窗口管理器是否显示边框:请参见在这里文档。这可以在执行过程中使用。

另一个有用的功能是clear_border():在fl_window :: show()函数之前调用它,使窗口管理器隐藏了边框。参见

下面的(简单)代码显示了如何使用这些功能。

#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();

}

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();

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文