Example #1
0
LinuxEnvironment::LinuxEnvironment(Display *display, Window window) : Environment()
{
	m_display = display;
	m_window = window;

	m_bCursorClipped = false;
	m_bCursorRequest = false;
	m_bCursorReset = false;
	m_bCursorVisible = true;
	m_bIsCursorInsideWindow = false;
	m_mouseCursor = XCreateFontCursor(m_display, XC_left_ptr);
	m_invisibleCursor = makeBlankCursor();
	m_cursorType = CURSORTYPE::CURSOR_NORMAL;

	m_atom_UTF8_STRING = XInternAtom(m_display, "UTF8_STRING", False);
	m_atom_CLIPBOARD = XInternAtom(m_display, "CLIPBOARD", False);
	m_atom_TARGETS = XInternAtom(m_display, "TARGETS", False);

	m_bFullScreen = false;

	m_bIsRestartScheduled = false;
	m_bResizeDelayHack = false;
	m_bPrevCursorHack = false;
	m_bFullscreenWasResizable = true;

	// TODO: init monitors
	if (m_vMonitors.size() < 1)
	{
		///debugLog("WARNING: No monitors found! Adding default monitor ...\n");

		const Vector2 windowSize = getWindowSize();
		m_vMonitors.push_back(McRect(0, 0, windowSize.x, windowSize.y));
	}
}
Example #2
0
/* CENTRY */
void APIENTRY 
glutSetCursor(int cursor)
{
  Cursor xcursor;

  if (cursor >= 0 &&
    cursor < sizeof(cursorTable) / sizeof(cursorTable[0])) {
    if (cursorTable[cursor].cursor == None)
      cursorTable[cursor].cursor = XCreateFontCursor(__glutDisplay,
        cursorTable[cursor].glyph);
    xcursor = cursorTable[cursor].cursor;
  } else {
    /* Special cases. */
    switch (cursor) {
    case GLUT_CURSOR_INHERIT:
#if defined(WIN32)
      /* must be a parent - this bit of voodoo is brought to you by
	 your friendly neighborhood Win32 API.  It allows the parent
	 to override the setting of the child windows cursor (ACK!).
	 Therefore, if this parent has children (and the cursor is in
	 one), DON'T SET THE CURSOR.  */
      if (__glutCurrentWindow->parent)
        return;
      else {
        if (__glutCurrentWindow->win != GetFocus())
          return;
        xcursor = cursorTable[0].cursor;
        if (xcursor == NULL)
          xcursor =
            cursorTable[0].cursor =
            LoadCursor(NULL, cursorTable[0].glyph);
      }
#else
      xcursor = None;
#endif
      break;
    case GLUT_CURSOR_NONE:
      if (blankCursor == None)
        blankCursor = makeBlankCursor();
      xcursor = blankCursor;
      break;
    case GLUT_CURSOR_FULL_CROSSHAIR:
      if (fullCrosshairCusor == None)
        fullCrosshairCusor = getFullCrosshairCursor();
      xcursor = fullCrosshairCusor;
      break;
    }
  }
  __glutCurrentWindow->cursor = cursor;
  XDefineCursor(__glutDisplay,
    __glutCurrentWindow->win, xcursor);
  XFlush(__glutDisplay);
}