示例#1
0
void window_action(Task* tsk, int action) {
    if (!tsk) return;
    int desk;
    switch (action) {
    case CLOSE:
        set_close(tsk->win);
        break;
    case TOGGLE:
        set_active(tsk->win);
        break;
    case ICONIFY:
        XIconifyWindow(server.dsp, tsk->win, server.screen);
        break;
    case TOGGLE_ICONIFY:
        if (task_active && tsk->win == task_active->win)
            XIconifyWindow(server.dsp, tsk->win, server.screen);
        else
            set_active(tsk->win);
        break;
    case SHADE:
        window_toggle_shade(tsk->win);
        break;
    case MAXIMIZE_RESTORE:
        window_maximize_restore(tsk->win);
        break;
    case MAXIMIZE:
        window_maximize_restore(tsk->win);
        break;
    case RESTORE:
        window_maximize_restore(tsk->win);
        break;
    case DESKTOP_LEFT:
        if (tsk->desktop == 0) break;
        desk = tsk->desktop - 1;
        windows_set_desktop(tsk->win, desk);
        if (desk == server.desktop) set_active(tsk->win);
        break;
    case DESKTOP_RIGHT:
        if (tsk->desktop == (uint32_t)server.nb_desktop) break;
        desk = tsk->desktop + 1;
        windows_set_desktop(tsk->win, desk);
        if (desk == server.desktop) set_active(tsk->win);
        break;
    case NEXT_TASK: {
        Task* tsk1;
        tsk1 = next_task(find_active_task(tsk, task_active));
        set_active(tsk1->win);
    }
    break;
    case PREV_TASK: {
        Task* tsk1;
        tsk1 = prev_task(find_active_task(tsk, task_active));
        set_active(tsk1->win);
    }
    }
}
示例#2
0
void UXViewport::Iconify()
{
	guard(UXViewport::Iconify);

	if (Iconified)
		return;
		
	Iconified = true;

	// Pause the game if applicable.
	if( GIsRunning )
		Exec( TEXT("SETPAUSE 1"), *this );

	// Release the mouse.
	SetMouseCapture( 0, 0, 0 );
	SetDrag( 0 );

	// Reset the input buffer.
	Input->ResetInput();

	// End fullscreen.
	if( BlitFlags & BLIT_Fullscreen )
		EndFullscreen();
	GetOuterUClient()->MakeCurrent( NULL );

	// Turn auto repeat back on.
	XAutoRepeatOn( XDisplay );

	// Iconify the window.
	XIconifyWindow( XDisplay, XWindow, DefaultScreen(XDisplay) );	
	unguard;
}
示例#3
0
文件: clientwin.c 项目: z24/skippy-xd
static int
clientwin_action(ClientWin *cw, enum cliop action) {
	session_t * const ps = cw->mainwin->ps;
	const Window wid = cw->wid_client;

	switch (action) {
		case CLIENTOP_NO:
			break;
		case CLIENTOP_FOCUS:
			childwin_focus(cw);
			return 1;
		case CLIENTOP_ICONIFY:
			XIconifyWindow(ps->dpy, wid, ps->screen);
			break;
		case CLIENTOP_SHADE_EWMH:
			wm_shade_window_ewmh(ps, wid);
			break;
		case CLIENTOP_CLOSE_ICCWM:
			wm_close_window_iccwm(ps, wid);
			break;
		case CLIENTOP_CLOSE_EWMH:
			wm_close_window_ewmh(ps, wid);
			break;
		case CLIENTOP_DESTROY:
			XDestroyWindow(cw->mainwin->ps->dpy, wid);
			break;
	}

	return 0;
}
示例#4
0
void ShowMinimizedWindow(QWidget *widget, bool minimized)
{
    const auto display = QX11Info::display();
    const auto screen = QX11Info::appScreen();

    XEvent xev;
    memset(&xev, 0, sizeof(xev));
    const Atom net_wm_state = XInternAtom(display, kAtomNameWmState, false);
    const Atom hidden = XInternAtom(display, kAtomNameHidden, false);
    xev.xclient.type = ClientMessage;
    xev.xclient.message_type = net_wm_state;
    xev.xclient.display = display;
    xev.xclient.window = widget->winId();
    xev.xclient.format = 32;

    if (minimized) {
        xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
    } else {
        xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
    }
    xev.xclient.data.l[1] = hidden;
    xev.xclient.data.l[2] = 0;
    xev.xclient.data.l[3] = 1;

    XSendEvent(display,
               QX11Info::appRootWindow(screen),
               false,
               SubstructureRedirectMask | SubstructureNotifyMask,
               &xev
              );

    XIconifyWindow(display, widget->winId(), screen);
    XFlush(display);
}
示例#5
0
/*
 * Iconify the specified window (top-level windows only)
 */
void fgPlatformIconifyWindow( SFG_Window *window )
{
    XIconifyWindow( fgDisplay.pDisplay.Display, window->Window.Handle,
                    fgDisplay.pDisplay.Screen );
    XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */

    fgStructure.CurrentWindow->State.Visible   = GL_FALSE;
}
示例#6
0
void XWindow::setIconify(bool Iconify)
{
    if(Iconify)
    {
        XIconifyWindow(this->getDisplay(),this->getWindow(),0);
    }
    else
    {
        XMapWindow(this->getDisplay(), this->getWindow());
    }
}
示例#7
0
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
{
    if (window->x11.overrideRedirect)
    {
        // Override-redirect windows cannot be iconified or restored, as those
        // tasks are performed by the window manager
        return;
    }

    XIconifyWindow(_glfw.x11.display, window->x11.handle, _glfw.x11.screen);
}
示例#8
0
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
{
    if (window->X11.overrideRedirect)
    {
        // We can't iconify/restore override-redirect windows, as that's
        // performed by the window manager
        return;
    }

    XIconifyWindow(_glfwLibrary.X11.display,
                   window->X11.handle,
                   _glfwLibrary.X11.screen);
}
示例#9
0
void TaskBar::minimize_all()
{
    Window *wins=0;
    int num_windows = Fl_WM::get_windows_mapping(wins);

    int current_workspace = Fl_WM::get_current_workspace();
    for(int n=0; n<num_windows; n++) {
        if(current_workspace == Fl_WM::get_window_desktop(wins[n]) && GetState(wins[n])>0)
            XIconifyWindow(fl_display, wins[n], fl_screen);
    }
    XSync(fl_display, True);
    active = 0;
}
示例#10
0
void FWindow::Linux_Minimize(GLboolean ShouldBeMinimized)
{
	if(ShouldBeMinimized)
	{
		XIconifyWindow(WindowManager::GetDisplay(),
				WindowHandle, 0);
	}

	else
	{
		XMapWindow(WindowManager::GetDisplay(), WindowHandle);
	}
}
示例#11
0
bool CWinSystemX11::Minimize()
{
  m_bWasFullScreenBeforeMinimize = m_bFullScreen;
  if (m_bWasFullScreenBeforeMinimize)
  {
    m_bIgnoreNextFocusMessage = true;
    g_graphicsContext.ToggleFullScreenRoot();
  }

  XIconifyWindow(m_dpy, m_mainWindow, m_nScreen);

  m_minimized = true;
  return true;
}
示例#12
0
void wxTopLevelWindowGTK::Iconize( bool iconize )
{
   if (iconize)
   {
       GdkWindow *window = m_widget->window;

       // you should do it later, for example from OnCreate() handler
       wxCHECK_RET( window, wxT("frame not created yet - can't iconize") );

       XIconifyWindow( GDK_WINDOW_XDISPLAY( window ),
                       GDK_WINDOW_XWINDOW( window ),
                       DefaultScreen( GDK_DISPLAY() ) );
   }
}
示例#13
0
/* Iconify the window */
int CGX_IconifyWindow(_THIS)
{
#if 0
	int result;

	SDL_Lock_EventThread();
	result = XIconifyWindow(SDL_Display, WMwindow, SDL_Screen);
	XSync(SDL_Display, False);
	SDL_Unlock_EventThread();
	return(result);
#else
	return 0;
#endif
}
示例#14
0
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
{
    if (window->x11.overrideRedirect)
    {
        // Override-redirect windows cannot be iconified or restored, as those
        // tasks are performed by the window manager
        _glfwInputError(GLFW_API_UNAVAILABLE,
                        "X11: Iconification of full screen windows requires "
                        "a WM that supports EWMH");
        return;
    }

    XIconifyWindow(_glfw.x11.display, window->x11.handle, _glfw.x11.screen);
}
示例#15
0
文件: wincmd.c 项目: setzer22/lxpanel
/* Execute a window command. */
static void wincmd_execute(WinCmdPlugin * wc, WindowCommand command)
{
    /* Get the list of all windows. */
    int client_count;
    Window * client_list = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &client_count);
    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
    if (client_list != NULL)
    {
        /* Loop over all windows. */
        int current_desktop = get_net_current_desktop();
        int i;
        for (i = 0; i < client_count; i++)
        {
            /* Get the desktop and window type properties. */
            NetWMWindowType nwwt;
            int task_desktop = get_net_wm_desktop(client_list[i]);
            get_net_wm_window_type(client_list[i], &nwwt);

            /* If the task is visible on the current desktop and it is an ordinary window,
             * execute the requested Iconify or Shade change. */
            if (((task_desktop == -1) || (task_desktop == current_desktop))
                && (( ! nwwt.dock) && ( ! nwwt.desktop) && ( ! nwwt.splash)))
            {
                switch (command)
                {
                    case WC_NONE:
                        break;

                    case WC_ICONIFY:
                        if (( ! wc->toggle_preference) || ( ! wc->toggle_state))
                            XIconifyWindow(xdisplay, client_list[i], DefaultScreen(xdisplay));
                        else
                            XMapWindow (xdisplay, client_list[i]);
                        break;

                    case WC_SHADE:
                        Xclimsg(client_list[i], a_NET_WM_STATE,
                            ((( ! wc->toggle_preference) || ( ! wc->toggle_state)) ? a_NET_WM_STATE_ADD : a_NET_WM_STATE_REMOVE),
                            a_NET_WM_STATE_SHADED, 0, 0, 0);
                        break;
                }
            }
        }
        XFree(client_list);

	/* Adjust toggle state. */
        wincmd_adjust_toggle_state(wc);
    }
}
示例#16
0
void wxTopLevelWindowX11::Iconize(bool iconize)
{
    if ( !iconize )
    {
        Restore();
        return;
    }

    if (!m_iconized && X11GetMainWindow())
    {
        if (XIconifyWindow(wxGlobalDisplay(),
            (Window) X11GetMainWindow(), DefaultScreen(wxGlobalDisplay())) != 0)
            m_iconized = true;
    }
}
示例#17
0
	void X11Window::minimize()
	{
		if (!is_window_mapped)
			log_event("debug", "clan::X11Window::minimize(): Window is not yet mapped.");

		if (!is_minimized())
		{
			log_event("debug", "clan::X11Window::minimize(): Minimizing.");
			restore_to_maximized = is_maximized();
			XIconifyWindow(handle.display, handle.window, handle.screen);
			minimized = true;
		}
		else
		{
			log_event("debug", "clan::X11Window::minimize(): Window already minimized.");
		}
	}
示例#18
0
void task_button_cb(TaskButton *b, Window w)
{
    if(Fl::event_button()==FL_RIGHT_MOUSE) {
        TaskButton::pushed = b;

        TaskButton::menu->color(b->color());
        TaskButton::menu->popup(Fl::event_x(), Fl::event_y()-calculate_height(TaskButton::menu));

    } else {
        if(TaskBar::active==w) {
            XIconifyWindow(fl_display, w, fl_screen);
            XSync(fl_display, True);
            TaskBar::active = 0;
        } else {
            Fl_WM::set_active_window(w);
        }
    }
}
示例#19
0
void TopWindow::SyncState()
{
	GuiLock __; 
	LLOG("SyncState");
	SyncCaption();
	if(IsOpen() && GetWindow()) {		
		Window w = GetWindow();
		WmState(w, topmost, XAtom("_NET_WM_STATE_ABOVE"));
		WmState(w, state == MAXIMIZED, XAtom("_NET_WM_STATE_MAXIMIZED_HORZ"), XAtom("_NET_WM_STATE_MAXIMIZED_VERT"));
		if(state == MINIMIZED)
			XIconifyWindow(Xdisplay, GetWindow(), Xscreenno);
		else
			XMapWindow(Xdisplay, GetWindow());

		WmState(w, state == MINIMIZED, XAtom("_NET_WM_STATE_HIDDEN"));
		WmState(w, fullscreen, XAtom("_NET_WM_STATE_FULLSCREEN"));
	}
}
示例#20
0
static void
toggle_iconify(wincmd *wc, guint32 action)
{
    Window *win = NULL;
    int num, i;
    guint32 tmp2, dno;
    net_wm_window_type nwwt;
    
    ENTER;
    win = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &num);
    if (!win)
	RET();
    if (!num)
        goto end;
    //tmp = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, XA_CARDINAL, 0);    
    dno = get_net_current_desktop();
    DBG("wincmd: #desk=%d\n", dno);
    //XFree(tmp);
    for (i = 0; i < num; i++) {
        int skip;

        tmp2 = get_net_wm_desktop(win[i]);
        DBG("wincmd: win=0x%x dno=%d...", win[i], tmp2);
        if ((tmp2 != -1) && (tmp2 != dno)) {
            DBG("skip - not cur desk\n");
            continue;
        }
        get_net_wm_window_type(win[i], &nwwt);
        skip = (nwwt.dock || nwwt.desktop || nwwt.splash);
        if (skip) {
            DBG("skip - omnipresent window type\n");
            continue;
        }
        if (action)
            XIconifyWindow(GDK_DISPLAY(), win[i], DefaultScreen(GDK_DISPLAY()));
        else
            XMapWindow (GDK_DISPLAY(), win[i]);
        DBG("ok\n");
    }
    
 end:
    XFree(win);
    RET();
}
示例#21
0
/*
 * Iconify the current window (top-level windows only)
 */
void FGAPIENTRY glutIconifyWindow( void )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIconifyWindow" );
    FREEGLUT_EXIT_IF_NO_WINDOW ( "glutIconifyWindow" );

    fgStructure.CurrentWindow->State.Visible   = GL_FALSE;
#if TARGET_HOST_UNIX_X11

    XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
                    fgDisplay.Screen );
    XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */

#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE

    ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_MINIMIZE );

#endif

    fgStructure.CurrentWindow->State.Redisplay = GL_FALSE;
}
示例#22
0
/*
 * Iconify the current window (top-level windows only)
 */
void FGAPIENTRY glutIconifyWindow( void )
{
    freeglut_assert_ready;
    freeglut_assert_window;

    fgStructure.Window->State.Visible   = GL_FALSE;
#if TARGET_HOST_UNIX_X11

    XIconifyWindow( fgDisplay.Display, fgStructure.Window->Window.Handle,
                    fgDisplay.Screen );
    XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */

#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE

    ShowWindow( fgStructure.Window->Window.Handle, SW_MINIMIZE );

#endif

    fgStructure.Window->State.Redisplay = GL_FALSE;
}
void
button_callback (MBTrayApp *app, int x, int y, Bool is_released )
{
  int abs_x, abs_y;
  Bool do_anim = False;

  ButtonIsDown = True;
  if (is_released)
    {
      ButtonIsDown = False;
      mb_tray_app_repaint (app);
      switch (action)
	{
	case ACTION_NONE:
	  fork_exec(cmd_str);
	  do_anim = DoAnimation;
	  break;
	case ACTION_KILL:
	  if (win_launched && win_exists(win_launched, mb_tray_app_xrootwin(app)))
	    {
	      kill_launched_win(win_launched);
	      win_launched = None;
	    } else {
	      fork_exec(cmd_str);
	      win_launched = get_launch_window();
	    }
	  break;
	case ACTION_TOGGLE_WIN_STATE:
	  if (win_launched && win_exists(win_launched, mb_tray_app_xrootwin(app)))
	    {
	      XWindowAttributes win_attrib;
	      XGetWindowAttributes(dpy, win_launched, &win_attrib);
	      
	      if (win_attrib.map_state == IsUnmapped ||
		  get_win_state(win_launched) != NormalState)
		XMapRaised(dpy, win_launched);
	      else
		XIconifyWindow(dpy, win_launched, screen);
	    }
	  else
	    {
	      fork_exec(cmd_str);
	      win_launched = get_launch_window();
	    }
	  break;
	case ACTION_MESSAGE_DOCK:
	  send_panel_message(cmd_str);
	  break;
#ifdef USE_LIBSN
	case ACTION_SN:
	  do_anim = DoAnimation;
	  sn_activate(win_panel_title, cmd_str);
	  break;
	case ACTION_SI:
	  do_anim = DoAnimation;
	  si_activate(win_panel_title, cmd_str);
	  break;
#endif
	}

      if (do_anim)
	{
	  mb_tray_app_get_absolute_coords (app, &abs_x, &abs_y); 

	  mb_util_animate_startup(mb_tray_app_xdisplay (app), 
				  abs_x,
				  abs_y,
				  mb_tray_app_width (app),
				  mb_tray_app_height (app));
	}
    } else mb_tray_app_repaint (app);


}
示例#24
0
// ----------------------------------------------------------------------------------------------
//    Iconify window.
// ----------------------------------------------------------------------------------------------
void wsIconify(wsTWindow win)
{
    XIconifyWindow(wsDisplay, win.WindowID, 0);
}
示例#25
0
// ===== IconifyWindow() =====
void LX11::IconifyWindow(WId win){
  XIconifyWindow(QX11Info::display(), win, QX11Info::appScreen());	
}
示例#26
0
void X11Window::_impl_minimize()
{    
    XIconifyWindow(m_Display, m_Window, DefaultScreen(m_Display));
}
示例#27
0
void X11Factory::minimize()
{
    XIconifyWindow( m_pDisplay->getDisplay(), m_pDisplay->getMainWindow(),
                    DefaultScreen( m_pDisplay->getDisplay() ) );
}
示例#28
0
static GLUTwindow *
processWindowWorkList(GLUTwindow * window)
{
  int workMask;

  if (window->prevWorkWin) {
    window->prevWorkWin = processWindowWorkList(window->prevWorkWin);
  } else {
    beforeEnd = &window->prevWorkWin;
  }

  /* Capture work mask for work that needs to be done to this
     window, then clear the window's work mask (excepting the
     dummy work bit, see below).  Then, process the captured
     work mask.  This allows callbacks in the processing the
     captured work mask to set the window's work mask for
     subsequent processing. */

  workMask = window->workMask;
  assert((workMask & GLUT_DUMMY_WORK) == 0);

  /* Set the dummy work bit, clearing all other bits, to
     indicate that the window is currently on the window work
     list _and_ that the window's work mask is currently being
     processed.  This convinces __glutPutOnWorkList that this
     window is on the work list still. */
  window->workMask = GLUT_DUMMY_WORK;

  /* Optimization: most of the time, the work to do is a
     redisplay and not these other types of work.  Check for
     the following cases as a group to before checking each one
     individually one by one. This saves about 25 MIPS
     instructions in the common redisplay only case. */
  if (workMask & (GLUT_EVENT_MASK_WORK | GLUT_DEVICE_MASK_WORK |
      GLUT_CONFIGURE_WORK | GLUT_COLORMAP_WORK | GLUT_MAP_WORK)) {
#if !defined(_WIN32)
    /* Be sure to set event mask BEFORE map window is done. */
    if (workMask & GLUT_EVENT_MASK_WORK) {
      long eventMask;

      /* Make sure children are not propogating events this
         window is selecting for.  Be sure to do this before
         enabling events on the children's parent. */
      if (window->children) {
        GLUTwindow *child = window->children;
        unsigned long attribMask = CWDontPropagate;
        XSetWindowAttributes wa;

        wa.do_not_propagate_mask = window->eventMask & GLUT_DONT_PROPAGATE_FILTER_MASK;
        if (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK) {
          wa.event_mask = child->eventMask | (window->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK);
          attribMask |= CWEventMask;
        }
        do {
          XChangeWindowAttributes(__glutDisplay, child->win,
            attribMask, &wa);
          child = child->siblings;
        } while (child);
      }
      eventMask = window->eventMask;
      if (window->parent && window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK)
        eventMask |= (window->parent->eventMask & GLUT_HACK_STOP_PROPAGATE_MASK);
      XSelectInput(__glutDisplay, window->win, eventMask);
      if (window->overlay)
        XSelectInput(__glutDisplay, window->overlay->win,
          window->eventMask & GLUT_OVERLAY_EVENT_FILTER_MASK);
    }
#endif /* !_WIN32 */
    /* Be sure to set device mask BEFORE map window is done. */
    if (workMask & GLUT_DEVICE_MASK_WORK) {
      __glutUpdateInputDeviceMaskFunc(window);
    }
    /* Be sure to configure window BEFORE map window is done. */
    if (workMask & GLUT_CONFIGURE_WORK) {
#if defined(_WIN32)
      RECT changes;
      POINT point;
      UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER
	| SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOZORDER;

      GetClientRect(window->win, &changes);
      
      /* If this window is a toplevel window, translate the 0,0 client
         coordinate into a screen coordinate for proper placement. */
      if (!window->parent) {
        point.x = 0;
        point.y = 0;
        ClientToScreen(window->win, &point);
        changes.left = point.x;
        changes.top = point.y;
      }
      if (window->desiredConfMask & (CWX | CWY)) {
        changes.left = window->desiredX;
        changes.top = window->desiredY;
	flags &= ~SWP_NOMOVE;
      }
      if (window->desiredConfMask & (CWWidth | CWHeight)) {
        changes.right = changes.left + window->desiredWidth;
        changes.bottom = changes.top + window->desiredHeight;
	flags &= ~SWP_NOSIZE;
	/* XXX If overlay exists, resize the overlay here, ie.
	   if (window->overlay) ... */
      }
      if (window->desiredConfMask & CWStackMode) {
	flags &= ~SWP_NOZORDER;
	/* XXX Overlay support might require something special here. */
      }

      /* Adjust the window rectangle because Win32 thinks that the x, y,
         width & height are the WHOLE window (including decorations),
         whereas GLUT treats the x, y, width & height as only the CLIENT
         area of the window.  Only do this to top level windows
         that are not in game mode (since game mode windows do
         not have any decorations). */
      if (!window->parent && window != __glutGameModeWindow) {
        AdjustWindowRect(&changes,
          WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
          FALSE);
      }

      /* Do the repositioning, moving, and push/pop. */
      SetWindowPos(window->win,
        window->desiredStack == Above ? HWND_TOP : HWND_NOTOPMOST,
        changes.left, changes.top,
        changes.right - changes.left, changes.bottom - changes.top,
        flags);

      /* Zero out the mask. */
      window->desiredConfMask = 0;

      /* This hack causes the window to go back to the right position
         when it is taken out of fullscreen mode. */
      if (workMask & GLUT_FULL_SCREEN_WORK) {
        window->desiredConfMask |= CWX | CWY;
        window->desiredX = point.x;
        window->desiredY = point.y;
      }
#else /* !_WIN32 */
      XWindowChanges changes;

      changes.x = window->desiredX;
      changes.y = window->desiredY;
      if (window->desiredConfMask & (CWWidth | CWHeight)) {
        changes.width = window->desiredWidth;
        changes.height = window->desiredHeight;
        if (window->overlay)
          XResizeWindow(__glutDisplay, window->overlay->win,
            window->desiredWidth, window->desiredHeight);
        if (__glutMotifHints != None) {
          if (workMask & GLUT_FULL_SCREEN_WORK) {
            MotifWmHints hints;

            hints.flags = MWM_HINTS_DECORATIONS;
            hints.decorations = 0;  /* Absolutely no
                                       decorations. */
            XChangeProperty(__glutDisplay, window->win,
              __glutMotifHints, __glutMotifHints, 32,
              PropModeReplace, (unsigned char *) &hints, 4);
            if (workMask & GLUT_MAP_WORK) {
              /* Handle case where glutFullScreen is called
                 before the first time that the window is
                 mapped. Some window managers will randomly or
                 interactively position the window the first
                 time it is mapped if the window's
                 WM_NORMAL_HINTS property does not request an
                 explicit position. We don't want any such
                 window manager interaction when going
                 fullscreen.  Overwrite the WM_NORMAL_HINTS
                 property installed by glutCreateWindow's
                 XSetWMProperties property with one explicitly
                 requesting a fullscreen window. */
              XSizeHints hints;

              hints.flags = USPosition | USSize;
              hints.x = 0;
              hints.y = 0;
              hints.width = window->desiredWidth;
              hints.height = window->desiredHeight;
              XSetWMNormalHints(__glutDisplay, window->win, &hints);
            }
          } else {
            XDeleteProperty(__glutDisplay, window->win, __glutMotifHints);
          }
        }
      }
      if (window->desiredConfMask & CWStackMode) {
        changes.stack_mode = window->desiredStack;
        /* Do not let glutPushWindow push window beneath the
           underlay. */
        if (window->parent && window->parent->overlay
          && window->desiredStack == Below) {
          changes.stack_mode = Above;
          changes.sibling = window->parent->overlay->win;
          window->desiredConfMask |= CWSibling;
        }
      }
      XConfigureWindow(__glutDisplay, window->win,
        window->desiredConfMask, &changes);
      window->desiredConfMask = 0;
#endif
    }
#if !defined(_WIN32)
    /* Be sure to establish the colormaps BEFORE map window is
       done. */
    if (workMask & GLUT_COLORMAP_WORK) {
      __glutEstablishColormapsProperty(window);
    }
#endif
    if (workMask & GLUT_MAP_WORK) {
      switch (window->desiredMapState) {
      case WithdrawnState:
        if (window->parent) {
          XUnmapWindow(__glutDisplay, window->win);
        } else {
          XWithdrawWindow(__glutDisplay, window->win,
            __glutScreen);
        }
        window->shownState = 0;
        break;
      case NormalState:
        XMapWindow(__glutDisplay, window->win);
        window->shownState = 1;
        break;
#ifdef _WIN32
      case GameModeState:  /* Not an Xlib value. */
        ShowWindow(window->win, SW_SHOW);
        window->shownState = 1;
        break;
#endif
      case IconicState:
        XIconifyWindow(__glutDisplay, window->win, __glutScreen);
        window->shownState = 0;
        break;
      }
    }
  }
  if (workMask & (GLUT_REDISPLAY_WORK | GLUT_OVERLAY_REDISPLAY_WORK | GLUT_REPAIR_WORK | GLUT_OVERLAY_REPAIR_WORK)) {
    if (window->forceReshape) {
      /* Guarantee that before a display callback is generated
         for a window, a reshape callback must be generated. */
      __glutSetWindow(window);
      window->reshape(window->width, window->height);
      window->forceReshape = False;

      /* Setting the redisplay bit on the first reshape is
         necessary to make the "Mesa glXSwapBuffers to repair
         damage" hack operate correctly.  Without indicating a
         redisplay is necessary, there's not an initial back
         buffer render from which to blit from when damage
         happens to the window. */
      workMask |= GLUT_REDISPLAY_WORK;
    }
    /* The code below is more involved than otherwise necessary
       because it is paranoid about the overlay or entire window
       being removed or destroyed in the course of the callbacks.
       Notice how the global __glutWindowDamaged is used to record
       the layers' damage status.  See the code in glutLayerGet for
       how __glutWindowDamaged is used. The  point is to not have to
       update the "damaged" field after  the callback since the
       window (or overlay) may be destroyed (or removed) when the
       callback returns. */

    if (window->overlay && window->overlay->display) {
      int num = window->num;
      Window xid = window->overlay ? window->overlay->win : None;

      /* If an overlay display callback is registered, we
         differentiate between a redisplay needed for the
         overlay and/or normal plane.  If there is no overlay
         display callback registered, we simply use the
         standard display callback. */

      if (workMask & (GLUT_REDISPLAY_WORK | GLUT_REPAIR_WORK)) {
        if (__glutMesaSwapHackSupport) {
          if (window->usedSwapBuffers) {
            if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) {
	      SWAP_BUFFERS_WINDOW(window);
              goto skippedDisplayCallback1;
            }
          }
        }
        /* Render to normal plane. */
#ifdef _WIN32
        window->renderDc = window->hdc;
#endif
        window->renderWin = window->win;
        window->renderCtx = window->ctx;
        __glutWindowDamaged = (workMask & GLUT_REPAIR_WORK);
        __glutSetWindow(window);
        window->usedSwapBuffers = 0;
        window->display();
        __glutWindowDamaged = 0;

      skippedDisplayCallback1:;
      }
      if (workMask & (GLUT_OVERLAY_REDISPLAY_WORK | GLUT_OVERLAY_REPAIR_WORK)) {
        window = __glutWindowList[num];
        if (window && window->overlay &&
          window->overlay->win == xid && window->overlay->display) {

          /* Render to overlay. */
#ifdef _WIN32
          window->renderDc = window->overlay->hdc;
#endif
          window->renderWin = window->overlay->win;
          window->renderCtx = window->overlay->ctx;
          __glutWindowDamaged = (workMask & GLUT_OVERLAY_REPAIR_WORK);
          __glutSetWindow(window);
          window->overlay->display();
          __glutWindowDamaged = 0;
        } else {
          /* Overlay may have since been destroyed or the
             overlay callback may have been disabled during
             normal display callback. */
        }
      }
    } else {
      if (__glutMesaSwapHackSupport) {
        if (!window->overlay && window->usedSwapBuffers) {
          if ((workMask & (GLUT_REPAIR_WORK | GLUT_REDISPLAY_WORK)) == GLUT_REPAIR_WORK) {
	    SWAP_BUFFERS_WINDOW(window);
            goto skippedDisplayCallback2;
          }
        }
      }
      /* Render to normal plane (and possibly overlay). */
      __glutWindowDamaged = (workMask & (GLUT_OVERLAY_REPAIR_WORK | GLUT_REPAIR_WORK));
      __glutSetWindow(window);
      window->usedSwapBuffers = 0;
      window->display();
      __glutWindowDamaged = 0;

    skippedDisplayCallback2:;
    }
  }
  /* Combine workMask with window->workMask to determine what
     finish and debug work there is. */
  workMask |= window->workMask;

  if (workMask & GLUT_FINISH_WORK) {
    /* Finish work makes sure a glFinish gets done to indirect
       rendering contexts.  Indirect contexts tend to have much 
       longer latency because lots of OpenGL extension requests 
       can queue up in the X protocol stream. __glutSetWindow
       is where the finish works gets queued for indirect
       contexts. */
    __glutSetWindow(window);
#if !defined(_WIN32)
    if (!window->isDirect)
#endif
    {
       glFinish();
    }
  }
  if (workMask & GLUT_DEBUG_WORK) {
    __glutSetWindow(window);
    glutReportErrors();
  }
  /* Strip out dummy, finish, and debug work bits. */
  window->workMask &= ~(GLUT_DUMMY_WORK | GLUT_FINISH_WORK | GLUT_DEBUG_WORK);
  if (window->workMask) {
    /* Leave on work list. */
    return window;
  } else {
    /* Remove current window from work list. */
    return window->prevWorkWin;
  }
}
示例#29
0
	void window::collapse()
	{
    XIconifyWindow(env, hwnd, DefaultScreen((Display*)env));
	}
示例#30
0
int iupdrvDialogSetPlacement(Ihandle* ih, int x, int y)
{
  char* placement;

  if (iupAttribGetInt(ih, "FULLSCREEN"))
    return 1;
  
  placement = iupAttribGet(ih, "PLACEMENT");
  if (!placement)
    return 0;

  if (iupStrEqualNoCase(placement, "MINIMIZED"))
  {
    if (iupdrvDialogIsVisible(ih))
      XIconifyWindow(iupmot_display, XtWindow(ih->handle), iupmot_screen);
    else
    {
      /* TODO: This is not working, so force a minimize after visible.  */
      /*XWMHints wm_hints;                                               */
      /*wm_hints.flags = StateHint;                                      */
      /*wm_hints.initial_state = IconicState;                            */
      /*XSetWMHints(iupmot_display, XtWindow(ih->handle), &wm_hints);  */

      XtMapWidget(ih->handle);
      XIconifyWindow(iupmot_display, XtWindow(ih->handle), iupmot_screen);
    }
  }
  else if (iupStrEqualNoCase(placement, "MAXIMIZED"))
  {
    static Atom maxatoms[2] = {0, 0};
    if (!(maxatoms[0]))
    {
      maxatoms[0] = XmInternAtom(iupmot_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
      maxatoms[1] = XmInternAtom(iupmot_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
    }

    motDialogChangeWMState(ih, maxatoms[0], maxatoms[1], 1);
  }
  else if (iupStrEqualNoCase(placement, "FULL"))
  {
    int width, height;
    int border, caption, menu;
    iupdrvDialogGetDecoration(ih, &border, &caption, &menu);

    /* position the decoration outside the screen */
    x = -(border);
    y = -(border+caption+menu);

    /* the dialog client area will cover the task bar */
    iupdrvGetFullSize(&width, &height);

    height += menu; /* the menu is included in the client area size in Motif. */

    /* set the new size and position */
    /* The resize event will update the layout */
    XtVaSetValues(ih->handle,
      XmNx, (XtArgVal)x,  /* outside border */
      XmNy, (XtArgVal)y,
      XmNwidth, (XtArgVal)width,  /* client size */
      XmNheight, (XtArgVal)height,
      NULL);
  }

  iupAttribSetStr(ih, "PLACEMENT", NULL); /* reset to NORMAL */

  return 1;
}