news download themes documentation links










FbRootWindow.cc

00001 // FbRootWindow.cc
00002 // Copyright (c) 2003 Henrik Kinnunen (fluxgen<at>users.sourceforge.net)
00003 //
00004 // Permission is hereby granted, free of charge, to any person obtaining a
00005 // copy of this software and associated documentation files (the "Software"),
00006 // to deal in the Software without restriction, including without limitation
00007 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 // and/or sell copies of the Software, and to permit persons to whom the
00009 // Software is furnished to do so, subject to the following conditions:
00010 //
00011 // The above copyright notice and this permission notice shall be included in
00012 // all copies or substantial portions of the Software.
00013 //
00014 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00017 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020 // DEALINGS IN THE SOFTWARE.
00021 
00022 // $Id: FbRootWindow.cc,v 1.2 2003/05/12 04:29:50 fluxgen Exp $
00023 
00024 #include "FbRootWindow.hh"
00025 #include "App.hh"
00026 
00027 #include <X11/Xutil.h>
00028 
00029 FbRootWindow::FbRootWindow(int screen_num):
00030     FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)),
00031     m_visual(0),
00032     m_colormap(0) {
00033 
00034     Display *disp = FbTk::App::instance()->display();
00035 
00036     // search for a TrueColor Visual... if we can't find one... we will use the
00037     // default visual for the screen
00038     XVisualInfo vinfo_template, *vinfo_return;
00039     int vinfo_nitems;
00040 
00041     vinfo_template.screen = screen_num;
00042     vinfo_template.c_class = TrueColor;
00043     if ((vinfo_return = XGetVisualInfo(disp,
00044                                        VisualScreenMask | VisualClassMask,
00045                                        &vinfo_template, &vinfo_nitems)) &&
00046         vinfo_nitems > 0) {
00047 
00048         for (int i = 0; i < vinfo_nitems; i++) {
00049             if (DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
00050                 m_visual = vinfo_return[i].visual;
00051         }
00052 
00053         XFree(vinfo_return);
00054     }
00055 
00056     if (m_visual) {
00057         m_colormap = XCreateColormap(disp, window(),
00058                                      m_visual, AllocNone);
00059     } else {
00060         m_visual = DefaultVisual(disp, screen_num);
00061         m_colormap = DefaultColormap(disp, screen_num);
00062     }
00063 }
00064 
00065 void FbRootWindow::updateGeometry() {
00066     FbWindow::updateGeometry();
00067 }

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA