示例#1
0
文件: main.c 项目: Jasu/HashTWM
void ToggleTag(unsigned short tag) {
  HWND hwnd = GetForegroundWindow();

  if (FindNode(hwnd, tag)) {
    RemoveNode(hwnd, tag);
    MinimizeWindow(hwnd);
  } else {
    AddNode(hwnd, tag);

    if (one_tag_per_window) {
      RemoveNode(hwnd, current_tag);
      MinimizeWindow(hwnd);
    }
  }

  ArrangeWindows();
}
示例#2
0
void CPopupHandler::HandlePotentialPopup(HWND potential_popup, bool hard_kill)
{
	char title[MAX_WINDOW_TITLE];
	GetWindowText(potential_popup, title, MAX_WINDOW_TITLE);
	write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Going to handle [%d] [%s]\n",
			potential_popup, title);

	// First: ignore all harmless windows
	if (!IsWindow(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Not a window\n");
		return;
	}
	if (!IsWindowVisible(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is invisible\n");
		return;
	}
	if (WinIsMinimized(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is minimized\n");
		return;
	}
	if (WinIsZeroSized(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is zero-sized\n");
		return;
	}
	if (WinIsOutOfScreen(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is out of screen\n");
		return;
	}
	// Second: ignore the good windows
	//   and always present windows (to avoid flickering)
	// This includes:
	//   * program manager (desktop) 
	//   * task-bar with Start-button
	//   * task manager to be able to kill the popup-blocker if necessary ;-)
	if (WinIsDesktop(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is desktop\n");
		return;
	}
	if (WinIsTaskbar(potential_popup))
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is task-bar with Start-button\n");
		return;
	}
	if (WinIsTaskManager(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is task-manager\n");
		return;
	}
	if (WinIsProgramManager(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is program manager\n");
		return;
	}
	if (p_sharedmem->PokerWindowAttached(potential_popup))
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is a served poker table\n");
		return;
	}
	if (WinIsOpenHoldem(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window belongs to OpenHoldem\n");
		return;
	}
	
	if (WinIsBring(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window belongs to Bring\n");
		return;
	}

	GetWindowText(potential_popup, title, MAX_WINDOW_TITLE);
	// Minimize or kill the remaining ones
	if (hard_kill)
	{
		// CloseWindow():
		// http://msdn.microsoft.com/en-us/library/windows/desktop/ms632678%28v=vs.85%29.aspx
		// DestroyWindow() can't be used:
		// http://msdn.microsoft.com/en-us/library/windows/desktop/ms632682%28v=vs.85%29.aspx
		CloseWindow(potential_popup);
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Killed [%d] [%s]\n",
			potential_popup, title);
	}
	else
	{
#ifdef MESSAGEBOX_BEFORE_MINIMIZING
		message.format("going to minimize window [%i]\n[%s]",
			potential_popup, title);
		messagebox(0, message, "popup blocker", 0);
#endif
		MinimizeWindow(potential_popup);
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Minimized [%d] [%s]\n",
			potential_popup, title);
	}
}
示例#3
0
文件: main.c 项目: Jasu/HashTWM
// Minimizes all the windows with the specified tag
void MinimizeTag(unsigned short tag)
{
  node *temp;
  for (temp=tags[tag].nodes; temp; temp = temp->next)
    MinimizeWindow(temp->hwnd);
}