Skip to content

Commit

Permalink
dont draw border in fullscreen window
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Jun 20, 2016
1 parent 5d57aa4 commit 99f02b3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 14 deletions.
59 changes: 45 additions & 14 deletions kwm/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ extern kwm_thread KWMThread;
extern kwm_border MarkedBorder;
extern kwm_border FocusedBorder;

internal void
DrawFocusedBorder(ax_display *Display)
{
if((Display) &&
(Display->Space->Type == kCGSSpaceUser))
{
UpdateBorder("focused");
}
}

internal void
FloatNonResizable(ax_window *Window)
{
Expand Down Expand Up @@ -206,7 +216,7 @@ EVENT_CALLBACK(Callback_AXEvent_SpaceChanged)
if((FocusedApplication->Focus) &&
(AXLibSpaceHasWindow(FocusedApplication->Focus, Display->Space->ID)))
{
UpdateBorder("focused");
DrawFocusedBorder(Display);
MoveCursorToCenterOfWindow(FocusedApplication->Focus);
Display->Space->FocusedWindow = FocusedApplication->Focus->ID;
}
Expand All @@ -221,10 +231,13 @@ EVENT_CALLBACK(Callback_AXEvent_SpaceChanged)
if(Window)
{
AXLibSetFocusedWindow(Window);
UpdateBorder("focused");
DrawFocusedBorder(Display);
MoveCursorToCenterOfWindow(Window);
}
}

if(Display->Space->Type != kCGSSpaceUser)
ClearBorder(&FocusedBorder);
}

/* TODO(koekeishiya): Is this interesting (?)
Expand Down Expand Up @@ -275,14 +288,15 @@ EVENT_CALLBACK(Callback_AXEvent_ApplicationActivated)
DEBUG("AXEvent_ApplicationActivated: " << Application->Name);

FocusedApplication = Application;
UpdateBorder("focused");

StandbyOnFloat(Application->Focus);
if(Application->Focus)
{
ax_display *Display = AXLibWindowDisplay(Application->Focus);
if(AXLibSpaceHasWindow(Application->Focus, Display->Space->ID))
{
StandbyOnFloat(Application->Focus);
Display->Space->FocusedWindow = Application->Focus->ID;
DrawFocusedBorder(Display);
}
}
}

Expand Down Expand Up @@ -322,7 +336,7 @@ EVENT_CALLBACK(Callback_AXEvent_WindowDestroyed)
Display->Space->FocusedWindow = 0;

StandbyOnFloat(FocusedApplication->Focus);
UpdateBorder("focused");
DrawFocusedBorder(Display);
}

if(MarkedWindow == Window)
Expand Down Expand Up @@ -377,9 +391,9 @@ EVENT_CALLBACK(Callback_AXEvent_WindowFocused)
Window->Application->Focus = Window;
if(FocusedApplication == Window->Application)
{
StandbyOnFloat(Window);
UpdateBorder("focused");
ax_display *Display = AXLibWindowDisplay(Window);
StandbyOnFloat(Window);
DrawFocusedBorder(Display);
Display->Space->FocusedWindow = Window->ID;
}
}
Expand All @@ -390,16 +404,15 @@ EVENT_CALLBACK(Callback_AXEvent_WindowFocused)
EVENT_CALLBACK(Callback_AXEvent_WindowMoved)
{
ax_window *Window = (ax_window *) Event->Context;
ax_display *Display = AXLibWindowDisplay(Window);
DEBUG("AXEvent_WindowMoved: " << Window->Application->Name << " - " << Window->Name);

if(!Event->Intrinsic && KWMSettings.LockToContainer)
LockWindowToContainerSize(Window);

/*
if(FocusedApplication == Window->Application)
*/
DrawFocusedBorder(Display);

UpdateBorder("focused");
if(MarkedWindow == Window)
UpdateBorder("marked");
}
Expand All @@ -408,16 +421,15 @@ EVENT_CALLBACK(Callback_AXEvent_WindowMoved)
EVENT_CALLBACK(Callback_AXEvent_WindowResized)
{
ax_window *Window = (ax_window *) Event->Context;
ax_display *Display = AXLibWindowDisplay(Window);
DEBUG("AXEvent_WindowResized: " << Window->Application->Name << " - " << Window->Name);

if(!Event->Intrinsic && KWMSettings.LockToContainer)
LockWindowToContainerSize(Window);

/*
if(FocusedApplication == Window->Application)
*/
DrawFocusedBorder(Display);

UpdateBorder("focused");
if(MarkedWindow == Window)
UpdateBorder("marked");
}
Expand Down Expand Up @@ -1549,6 +1561,25 @@ void ShiftSubTreeWindowFocus(int Shift)
}
}

void FocusFirstLeafNode(ax_display *Display)
{
if(Display)
{
space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];
if(SpaceInfo->Settings.Mode == SpaceModeBSP)
{
tree_node *Node = NULL;
GetFirstLeafNode(SpaceInfo->RootNode, (void**)&Node);
SetWindowFocusByNode(Node);
}
else if(SpaceInfo->Settings.Mode == SpaceModeMonocle)
{
link_node *Node = SpaceInfo->RootNode->List;
SetWindowFocusByNode(Node);
}
}
}

void FocusWindowByID(uint32_t WindowID)
{
ax_window *Window = GetWindowByID(WindowID);
Expand Down
1 change: 1 addition & 0 deletions kwm/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bool FindClosestWindow(int Degrees, ax_window **ClosestWindow, bool Wrap);
void CenterWindow(ax_display *Display, ax_window *Window);

void FocusWindowByID(uint32_t WindowID);
void FocusFirstLeafNode(ax_display *Display);
void ToggleWindowFloating(uint32_t WindowID, bool Center);
void ToggleFocusedWindowFloating();
void ToggleFocusedWindowParentContainer();
Expand Down

0 comments on commit 99f02b3

Please sign in to comment.