void ChangeGapOfDisplay(const std::string &Side, int Offset) { screen_info *Screen = GetDisplayOfMousePointer(); space_info *Space = GetActiveSpaceOfScreen(Screen); if(Side == "all") { if(Space->Settings.Offset.VerticalGap + Offset >= 0) Space->Settings.Offset.VerticalGap += Offset; if(Space->Settings.Offset.HorizontalGap + Offset >= 0) Space->Settings.Offset.HorizontalGap += Offset; } else if(Side == "vertical") { if(Space->Settings.Offset.VerticalGap + Offset >= 0) Space->Settings.Offset.VerticalGap += Offset; } else if(Side == "horizontal") { if(Space->Settings.Offset.HorizontalGap + Offset >= 0) Space->Settings.Offset.HorizontalGap += Offset; } UpdateSpaceOfScreen(Space, Screen); }
void RefreshActiveDisplays(bool ShouldFocusScreen) { if(KWMScreen.Displays) free(KWMScreen.Displays); KWMScreen.Displays = (CGDirectDisplayID*) malloc(sizeof(CGDirectDisplayID) * KWMScreen.MaxCount); CGGetActiveDisplayList(KWMScreen.MaxCount, KWMScreen.Displays, &KWMScreen.ActiveCount); for(std::size_t DisplayIndex = 0; DisplayIndex < KWMScreen.ActiveCount; ++DisplayIndex) { unsigned int DisplayID = KWMScreen.Displays[DisplayIndex]; std::map<unsigned int, screen_info>::iterator It = KWMTiling.DisplayMap.find(DisplayID); if(It != KWMTiling.DisplayMap.end()) UpdateExistingScreenInfo(&KWMTiling.DisplayMap[DisplayID], DisplayID, DisplayIndex); else KWMTiling.DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex); DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex << " and Identifier " << CFStringGetCStringPtr(KWMTiling.DisplayMap[DisplayID].Identifier,kCFStringEncodingUTF8)); } if (ShouldFocusScreen) { screen_info *NewScreen = GetDisplayOfMousePointer(); if(NewScreen) GiveFocusToScreen(NewScreen->ID, NULL, false, true); } }
void ChangePaddingOfDisplay(const std::string &Side, int Offset) { screen_info *Screen = GetDisplayOfMousePointer(); if(Side == "left") { if(Screen->Space[Screen->ActiveSpace].PaddingLeft + Offset >= 0) Screen->Space[Screen->ActiveSpace].PaddingLeft += Offset; } else if(Side == "right") { if(Screen->Space[Screen->ActiveSpace].PaddingRight + Offset >= 0) Screen->Space[Screen->ActiveSpace].PaddingRight += Offset; } else if(Side == "top") { if(Screen->Space[Screen->ActiveSpace].PaddingTop + Offset >= 0) Screen->Space[Screen->ActiveSpace].PaddingTop += Offset; } else if(Side == "bottom") { if(Screen->Space[Screen->ActiveSpace].PaddingBottom + Offset >= 0) Screen->Space[Screen->ActiveSpace].PaddingBottom += Offset; } SetRootNodeContainer(Screen, Screen->Space[Screen->ActiveSpace].RootNode); CreateNodeContainers(Screen, Screen->Space[Screen->ActiveSpace].RootNode, true); ApplyNodeContainer(Screen->Space[Screen->ActiveSpace].RootNode); }
void UpdateActiveScreen() { screen_info *Screen = GetDisplayOfMousePointer(); if(Screen && KWMScreen.Current && KWMScreen.Current != Screen) { DEBUG("UpdateActiveScreen() Active Display Changed"); ClearMarkedWindow(); GiveFocusToScreen(Screen->ID, NULL, true, true); } }
void GetActiveDisplays() { CGGetActiveDisplayList(MaxDisplayCount, (CGDirectDisplayID*)&ActiveDisplays, &ActiveDisplaysCount); for(int DisplayIndex = 0; DisplayIndex < ActiveDisplaysCount; ++DisplayIndex) { unsigned int DisplayID = ActiveDisplays[DisplayIndex]; DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex);; DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex) } Screen = GetDisplayOfMousePointer(); CGDisplayRegisterReconfigurationCallback(DisplayReconfigurationCallBack, NULL); }
void GetActiveDisplays() { KWMScreen.Displays = (CGDirectDisplayID*) malloc(sizeof(CGDirectDisplayID) * KWMScreen.MaxCount); CGGetActiveDisplayList(KWMScreen.MaxCount, KWMScreen.Displays, &KWMScreen.ActiveCount); for(int DisplayIndex = 0; DisplayIndex < KWMScreen.ActiveCount; ++DisplayIndex) { unsigned int DisplayID = KWMScreen.Displays[DisplayIndex]; DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex);; DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex) } KWMScreen.Current = GetDisplayOfMousePointer(); CGDisplayRegisterReconfigurationCallback(DisplayReconfigurationCallBack, NULL); }
void ChangePaddingOfDisplay(const std::string &Side, int Offset) { screen_info *Screen = GetDisplayOfMousePointer(); space_info *Space = &Screen->Space[Screen->ActiveSpace]; if(Side == "left") { if(Space->Offset.PaddingLeft + Offset >= 0) Space->Offset.PaddingLeft += Offset; } else if(Side == "right") { if(Space->Offset.PaddingRight + Offset >= 0) Space->Offset.PaddingRight += Offset; } else if(Side == "top") { if(Space->Offset.PaddingTop + Offset >= 0) Space->Offset.PaddingTop += Offset; } else if(Side == "bottom") { if(Space->Offset.PaddingBottom + Offset >= 0) Space->Offset.PaddingBottom += Offset; } if(Space->RootNode) { if(Space->Mode == SpaceModeBSP) { SetRootNodeContainer(Screen, Space->RootNode); CreateNodeContainers(Screen, Space->RootNode, true); } else if(Space->Mode == SpaceModeMonocle) { tree_node *CurrentNode = Space->RootNode; while(CurrentNode) { SetRootNodeContainer(Screen, CurrentNode); CurrentNode = CurrentNode->RightChild; } } ApplyNodeContainer(Space->RootNode, Space->Mode); } }
void ChangeGapOfDisplay(const std::string &Side, int Offset) { screen_info *Screen = GetDisplayOfMousePointer(); if(Side == "vertical") { if(Screen->Space[Screen->ActiveSpace].VerticalGap + Offset >= 0) Screen->Space[Screen->ActiveSpace].VerticalGap += Offset; } else if(Side == "horizontal") { if(Screen->Space[Screen->ActiveSpace].HorizontalGap + Offset >= 0) Screen->Space[Screen->ActiveSpace].HorizontalGap += Offset; } CreateNodeContainers(Screen, Screen->Space[Screen->ActiveSpace].RootNode, true); ApplyNodeContainer(Screen->Space[Screen->ActiveSpace].RootNode); }
void RefreshActiveDisplays() { CGGetActiveDisplayList(MaxDisplayCount, (CGDirectDisplayID*)&ActiveDisplays, &ActiveDisplaysCount); for(int DisplayIndex = 0; DisplayIndex < ActiveDisplaysCount; ++DisplayIndex) { unsigned int DisplayID = ActiveDisplays[DisplayIndex]; std::map<unsigned int, screen_info>::iterator It; if(It != DisplayMap.end()) UpdateExistingScreenInfo(&DisplayMap[DisplayID], DisplayID, DisplayIndex); else DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex); DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex) } Screen = GetDisplayOfMousePointer(); }
screen_info *GetDisplayOfWindow(window_info *Window) { if(Window) { std::map<unsigned int, screen_info>::iterator It; for(It = KWMTiling.DisplayMap.begin(); It != KWMTiling.DisplayMap.end(); ++It) { screen_info *Screen = &It->second; if(Window->X >= Screen->X && Window->X <= Screen->X + Screen->Width && Window->Y >= Screen->Y && Window->Y <= Screen->Y + Screen->Height) return Screen; } return GetDisplayOfMousePointer(); } return NULL; }
void GetActiveDisplays() { KWMScreen.Displays = (CGDirectDisplayID*) malloc(sizeof(CGDirectDisplayID) * KWMScreen.MaxCount); CGGetActiveDisplayList(KWMScreen.MaxCount, KWMScreen.Displays, &KWMScreen.ActiveCount); for(std::size_t DisplayIndex = 0; DisplayIndex < KWMScreen.ActiveCount; ++DisplayIndex) { unsigned int DisplayID = KWMScreen.Displays[DisplayIndex]; KWMTiling.DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex);; DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex << " and Identifier " << CFStringGetCStringPtr(KWMTiling.DisplayMap[DisplayID].Identifier,kCFStringEncodingUTF8)); } KWMScreen.Current = GetDisplayOfMousePointer(); KWMScreen.Current->ActiveSpace = GetActiveSpaceOfDisplay(KWMScreen.Current); ShouldActiveSpaceBeManaged(); CGDisplayRegisterReconfigurationCallback(DisplayReconfigurationCallBack, NULL); }
void ChangePaddingOfDisplay(const std::string &Side, int Offset) { screen_info *Screen = GetDisplayOfMousePointer(); space_info *Space = GetActiveSpaceOfScreen(Screen); if(Side == "all") { if(Space->Settings.Offset.PaddingLeft + Offset >= 0) Space->Settings.Offset.PaddingLeft += Offset; if(Space->Settings.Offset.PaddingRight + Offset >= 0) Space->Settings.Offset.PaddingRight += Offset; if(Space->Settings.Offset.PaddingTop + Offset >= 0) Space->Settings.Offset.PaddingTop += Offset; if(Space->Settings.Offset.PaddingBottom + Offset >= 0) Space->Settings.Offset.PaddingBottom += Offset; } else if(Side == "left") { if(Space->Settings.Offset.PaddingLeft + Offset >= 0) Space->Settings.Offset.PaddingLeft += Offset; } else if(Side == "right") { if(Space->Settings.Offset.PaddingRight + Offset >= 0) Space->Settings.Offset.PaddingRight += Offset; } else if(Side == "top") { if(Space->Settings.Offset.PaddingTop + Offset >= 0) Space->Settings.Offset.PaddingTop += Offset; } else if(Side == "bottom") { if(Space->Settings.Offset.PaddingBottom + Offset >= 0) Space->Settings.Offset.PaddingBottom += Offset; } UpdateSpaceOfScreen(Space, Screen); }
void ChangeGapOfDisplay(const std::string &Side, int Offset) { screen_info *Screen = GetDisplayOfMousePointer(); space_info *Space = &Screen->Space[Screen->ActiveSpace]; if(Side == "vertical") { if(Space->Offset.VerticalGap + Offset >= 0) Space->Offset.VerticalGap += Offset; } else if(Side == "horizontal") { if(Space->Offset.HorizontalGap + Offset >= 0) Space->Offset.HorizontalGap += Offset; } if(Space->RootNode && Space->Mode == SpaceModeBSP) { CreateNodeContainers(Screen, Space->RootNode, true); ApplyNodeContainer(Space->RootNode, Space->Mode); } }
void RefreshActiveDisplays() { if(KWMScreen.Displays) free(KWMScreen.Displays); KWMScreen.Displays = (CGDirectDisplayID*) malloc(sizeof(CGDirectDisplayID) * KWMScreen.MaxCount); CGGetActiveDisplayList(KWMScreen.MaxCount, KWMScreen.Displays, &KWMScreen.ActiveCount); for(int DisplayIndex = 0; DisplayIndex < KWMScreen.ActiveCount; ++DisplayIndex) { unsigned int DisplayID = KWMScreen.Displays[DisplayIndex]; std::map<unsigned int, screen_info>::iterator It = DisplayMap.find(DisplayID); if(It != DisplayMap.end()) UpdateExistingScreenInfo(&DisplayMap[DisplayID], DisplayID, DisplayIndex); else DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex); DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex) } KWMScreen.Current = GetDisplayOfMousePointer(); }
void RefreshActiveDisplays() { CGGetActiveDisplayList(MaxDisplayCount, (CGDirectDisplayID*)&ActiveDisplays, &ActiveDisplaysCount); for(int DisplayIndex = 0; DisplayIndex < ActiveDisplaysCount; ++DisplayIndex) { unsigned int DisplayID = ActiveDisplays[DisplayIndex]; std::map<unsigned int, screen_info>::iterator It; if(It != DisplayMap.end()) { CGRect DisplayRect = CGDisplayBounds(ActiveDisplays[DisplayIndex]); DisplayMap[DisplayID].ID = DisplayIndex; DisplayMap[DisplayID].X = DisplayRect.origin.x; DisplayMap[DisplayID].Y = DisplayRect.origin.y; DisplayMap[DisplayID].Width = DisplayRect.size.width; DisplayMap[DisplayID].Height = DisplayRect.size.height; DisplayMap[DisplayID].PaddingTop = DefaultPaddingTop; DisplayMap[DisplayID].PaddingLeft = DefaultPaddingLeft; DisplayMap[DisplayID].PaddingRight = DefaultPaddingRight; DisplayMap[DisplayID].PaddingBottom = DefaultPaddingBottom; DisplayMap[DisplayID].VerticalGap = DefaultGapVertical; DisplayMap[DisplayID].HorizontalGap = DefaultGapHorizontal; DisplayMap[DisplayID].ForceContainerUpdate = true; } else { DisplayMap[DisplayID] = CreateDefaultScreenInfo(DisplayID, DisplayIndex); } DEBUG("DisplayID " << DisplayID << " has index " << DisplayIndex) } Screen = GetDisplayOfMousePointer(); }