MovableIcon::MovableIcon(Icon *i) : Fl_Window(desktop->x()+i->x(), desktop->y()+i->y(), i->w(), i->h()) { icon = i; set_override(); create(); Fl_Image *im = i->icon_im; if(im) { Pixmap mask = im->create_mask(im->width(), im->height()); XShapeCombineMask(fl_display, fl_xid(this), ShapeBounding, 0, 0, mask, ShapeSet); align(FL_ALIGN_INSIDE); image(im); } }
MovableIcon::MovableIcon(Icon* i) : Fl_Window(i->x(), i->y(), i->w(), i->h()), icon(i) { assert(icon != NULL); set_override(); create(); Fl_Image* img = icon->icon_image(); if(img) { #ifdef SHAPE Pixmap mask = img->create_mask(img->width(), img->height()); XShapeCombineMask(fl_display, fl_xid(this), ShapeBounding, 0, 0, mask, ShapeSet); #endif align(FL_ALIGN_INSIDE); image(img); } }
MovableIcon::MovableIcon(DesktopIcon* ic) : Fl_Window(ic->x(), ic->y(), ic->w(), ic->h()), icon(ic), mask(0) { E_ASSERT(icon != NULL); set_override(); color(ic->color()); begin(); /* * Force box be same width/height as icon so it * can fit inside masked window. */ #ifdef HAVE_SHAPE Fl_Image* img = ic->icon_image(); if(img) icon_box = new Fl_Box(0, 0, img->w(), img->h()); else icon_box = new Fl_Box(0, 0, w(), h()); #else icon_box = new Fl_Box(0, 0, w(), h()); #endif icon_box->image(ic->icon_image()); end(); }
int main(int argc, char **argv) { int setflag = 0; char *argv0; ARGBEGIN { case 's': setflag = 1; break; case 'r': setflag = 0; break; default: usage(argv0); } ARGEND; init_xcb(&conn); while (*argv) set_override(strtoul(*argv++, NULL, 16), setflag); xcb_flush(conn); kill_xcb(&conn); return 0; }
MovableIcon::MovableIcon(DesktopIcon* ic) : Fl_Window(ic->x(), ic->y(), ic->w(), ic->h()), icon(ic), mask(0), opacity_atom(0) { E_ASSERT(icon != NULL); set_override(); color(ic->color()); begin(); /* force box be same width/height as icon so it can fit inside masked window */ #ifdef HAVE_SHAPE Fl_Image* img = ic->image(); if(img) icon_box = new Fl_Box(0, 0, img->w(), img->h()); else icon_box = new Fl_Box(0, 0, w(), h()); #else icon_box = new Fl_Box(0, 0, w(), h()); #endif icon_box->image(ic->image()); end(); opacity_atom = XInternAtom(fl_display, "_NET_WM_WINDOW_OPACITY", False); }
MapsWindow::MapArea::MapInfoWin::MapInfoWin(): Fl_Menu_Window(1,1) { set_override(); end(); }
TipWin():Fl_Menu_Window(1,1) { // will autosize strcpy(tip, "X.XX"); set_override(); end(); }
void Splash::run(void) { E_ASSERT(slist != NULL); if(!show_splash) { while(next_client_nosplash()) ; return; } fl_register_images(); String path, splash_theme_path; #ifdef USE_LOCAL_CONFIG splash_theme_path = "splash-themes/"; #else splash_theme_path = Resource::find_data("themes/splash-themes", RES_SYS_ONLY); if(splash_theme_path.empty()) { E_WARNING(E_STRLOC ": Unable to locate splash themes in $XDG_DATA_DIRS directories\n"); return; } #endif splash_theme_path += E_DIR_SEPARATOR; splash_theme_path += *splash_theme; if(!file_test(splash_theme_path.c_str(), FILE_TEST_IS_DIR)) { E_WARNING(E_STRLOC ": Unable to locate '%s' in '%s' theme directory\n", splash_theme->c_str(), splash_theme_path.c_str()); return; } /* setup widgets */ begin(); Fl_Box* bimg = new Fl_Box(0, 0, w(), h()); Fl_Image* splash_img = 0; path = build_filename(splash_theme_path.c_str(), "background.png"); splash_img = Fl_Shared_Image::get(path.c_str()); if(splash_img) { int W = splash_img->w(); int H = splash_img->h(); /* update window and Box sizes */ size(W, H); bimg->size(W, H); bimg->image(splash_img); } /* * place message box at the bottom with * nice offset (10 px) from window borders */ msgbox = new Fl_Box(10, h() - 25 - 10, w() - 20, 25); /* * Setup icons positions, based on position of msgbox assuming someone * will not abuse splash to start hundrets of programs, since icons will * be placed only in horizontal order, one line, so in case their large * number, some of them will go out of window borders. * * Icon box will be 64x64 so larger icons can fit too. * * This code will use Fl_Group (moving group, later, will move all icons * saving me from code mess), but will not update it's w() for two reasons: * icons does not use it, and will be drawn correctly, and second, setting * width will initiate fltk layout engine which will mess everything up. */ Fl_Group* icon_group = new Fl_Group(10, msgbox->y() - 10 - 64, 0, 64); int X = icon_group->x(); int Y = icon_group->y(); /* offset between icons */ int ioffset = 5; /* FIXME: use malloc/something instead this */ icons = new Fl_Box*[slist->size()]; icon_group->begin(); int i = 0; const char* imgpath; Fl_Image* iconimg = 0; for(StartupItemListIter it = slist->begin(); it != slist->end(); ++it, ++i) { Fl_Box* bb = new Fl_Box(X, Y, 64, 64); path = build_filename(splash_theme_path.c_str(), (*it)->icon.c_str()); imgpath = path.c_str(); iconimg = Fl_Shared_Image::get(imgpath); if(!iconimg) { bb->label(_("No image")); bb->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP); } else bb->image(iconimg); bb->hide(); X += bb->w() + ioffset; icons[i] = bb; } icon_group->end(); /* see X as width of all icons */ int gx = w()/2 - X/2; /* gx can be negative */ gx = (gx > 10) ? gx : 10; icon_group->position(gx, Y); end(); clear_border(); /* * If set_override() is used, message boxes will be * popped behind splash. Using it or not ??? */ set_override(); // make sure window is centered int sw = DisplayWidth(fl_display, fl_screen); int sh = DisplayHeight(fl_display, fl_screen); position(sw/2 - w()/2, sh/2 - h()/2); show(); Fl::add_timeout(TIMEOUT_START, runner_cb, this); // to keep splash at the top #ifndef EDEWM_HAVE_NET_SPLASH global_splash = this; XSelectInput(fl_display, RootWindow(fl_display, fl_screen), SubstructureNotifyMask); Fl::add_handler(splash_xmessage_handler); #endif while(shown()) Fl::wait(); #ifndef EDEWM_HAVE_NET_SPLASH Fl::remove_handler(splash_xmessage_handler); #endif }
Fl_TooltipBox() : Fl_Menu_Window(0, 0) { style(Fl_Tooltip::default_style); set_override(); end(); }