#include "Core.hpp" #include #include #define WNCK_I_KNOW_THIS_IS_UNSTABLE #include #define GMENU_I_KNOW_THIS_IS_UNSTABLE #include #include #include #include #include #define RSRC_PATH "../rsrc/" using namespace std; using namespace net::lliurex::llxdo; using namespace net::lliurex::lgi; Core * Core::instance = nullptr; Core::Core() { quit_request=false; LoadRsrc(RSRC_PATH); //LoadRsrc("/usr/share/banners/lliurex/"); //LoadPlugins(); } Core::~Core() { cout<<"* Saving changes:..."; SaveSetup(); cout<<"ok"<::iterator iter; cout<<"* Unloading resources:..."; for(iter=surfaces.begin();iter!=surfaces.end();iter++) { cairo_surface_destroy(iter->second); } cout<<"ok"< it : plugins) { cout<<"-"< files; files=filesystem::List(path+"/*.png"); cout<<"* Loading resources:..."; for(int n=0;nmenu[gmenu_tree_entry_get_desktop_file_id(entry)]=info; /* cout<<"--entry name:"<slots.size()<32) core->slots.push_back(new SlotDesktop(info)); */ } item_type = gmenu_tree_iter_next(iter); } } void Core::LoadVintageSetup() { string path = filesystem::Home() + "/.lliurex-do/setup.cfg"; struct rule { const char * token[8]; int p; }; struct rule applications = {{"[setup]","applications","=","$APPLICATIONS"},0}; if(filesystem::Exists(path)) { ifstream file; string line; file.open(path.c_str()); while(!file.eof()) { file>>line; if(line!="" && line!=" ") { if(applications.p==3) { cout<<"* read:"<items = utils::str::Split(line,','); for(int n=0;n slot_settings = slot->Serialize(); for(string st : slot_settings) { file<<"\t"< libs; libs=filesystem::List("plugins/*.so"); for(string file : libs) { cout<<"-- file:"<GetScreenSize(&screen_width,&screen_height); vector dnd_targets; dnd_targets.push_back(string("text/uri-list")); window->SetDndTargets(dnd_targets); LoadMenu(); LoadVintageSetup(); /* * banner dimensions are 235x110 px * space between 20 px * |---10 px --| 235px |--10 px ---||---10 px --| 235px |--10 px ---| * */ int tile_width=235+20; int tile_height=110+20; int w_tiles = screen_width/tile_width; int h_tiles = screen_height/tile_height; if(h_tiles>4)h_tiles=4; cout<<"* tiles: "<GetXWindow()); wnck_window_set_geometry(wid,WNCK_WINDOW_GRAVITY_STATIC, (WnckWindowMoveResizeMask)(WNCK_WINDOW_CHANGE_X | WNCK_WINDOW_CHANGE_Y | WNCK_WINDOW_CHANGE_WIDTH | WNCK_WINDOW_CHANGE_HEIGHT), cx,cy,width,height); cout<<"* Computed position: "<AddLayer(dash); for(pair itm : menu) { slots.push_back(new SlotDesktop(itm.second)); } int to_fill = slots.size() % h_tiles; for(int n=0;nAdd(slots[n]); } cout<<" XID:"<GetXWindow()<DispatchEvents(LGI_DISPATCH_EVENTS_WAIT); window->Flip(); } window->Destroy(); delete window; } void Core::Quit() { quit_request=true; } Slot * Core::GetPlugin(string name) { void * lib = plugins[name]; if(lib==nullptr) { cout<<"Lib not found"<SendMessage(nullptr,nullptr,msg); }