Пример #1
0
void CFCEditorGLWindow::OnMouse(wxMouseEvent& event)
{
    if(event.ButtonDown(wxMOUSE_BTN_RIGHT))
    {
        if (!HasCapture())
        {
            CaptureMouse();
        }
        HideCursor();
        SetFocus();//Call this for catch the EVT_MOUSEWHEEL event, in left mouse button down event is not necessary to call this
        m_startPosition = event.GetPosition();
        m_bRightDown = true;
    }
    else if(event.ButtonUp(wxMOUSE_BTN_RIGHT))
    {
        if (!m_bLeftDown && HasCapture())
        {
            ReleaseMouse();
        }
        ShowCursor();
        m_bRightDown = false;
    }
    else if(event.ButtonDown(wxMOUSE_BTN_LEFT))
    {
        if (!HasCapture())
        {
            CaptureMouse();
        }
        HideCursor();
        m_startPosition = event.GetPosition();
        m_bLeftDown = true;
    }
    else if(event.ButtonUp(wxMOUSE_BTN_LEFT))
    {
        if (!m_bRightDown && HasCapture())
        {
            ReleaseMouse();
        }
        ShowCursor();
        m_bLeftDown = false;
    }
    else if(event.Dragging())
    {
        if (m_bRightDown || m_bLeftDown)
        {
            wxPoint curPos = event.GetPosition();
            wxPoint pnt = ClientToScreen(m_startPosition);
            SetCursorPos(pnt.x, pnt.y);
            if (m_bRightDown)
            {
                int nDeltaX = curPos.x - m_startPosition.x;
                int nDeltaY = curPos.y - m_startPosition.y;
                wxSize clientSize = GetClientSize();
                m_pCamera->Yaw((float)nDeltaX / clientSize.x);
                m_pCamera->Pitch((float)nDeltaY / clientSize.y);
            }
        }
    }
    event.Skip();
}
Пример #2
0
/**
**  Realize video memory.
*/
void RealizeVideoMemory()
{
#if defined(USE_OPENGL) || defined(USE_GLES)
	if (UseOpenGL) {
#ifdef USE_GLES_MAEMO
		SDL_GLES_SwapBuffers();
#endif
#ifdef USE_GLES_EGL
		eglSwapBuffers(eglDisplay, eglSurface);
#endif
#if defined(USE_OPENGL) || defined(USE_GLES_NATIVE)
		if (GLShaderPipelineSupported) {
			RenderFramebufferToScreen();
		} else {
			SDL_GL_SwapBuffers();
		}
#endif
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	} else
#endif
	{
		if (NumRects) {
			SDL_UpdateRects(TheScreen, NumRects, Rects);
			NumRects = 0;
		}
	}
	HideCursor();
}
Пример #3
0
void setOurBitmap(void)
{
	HideCursor();
	SetDisplay(display_page ? GrafPg1 : GrafPg0);
	SetBitmap(display_page ? GrafPg1 : GrafPg0);
	ShowCursor();
}
Пример #4
0
/*
 * SetWindowCursorForReal - set cursor in current window, if cursorNeedsDisp
 */
void SetWindowCursorForReal( void )
{
    if( !cursorNeedsDisplay || EditFlags.DisplayHold ) {
        return;
    }
    if( CurrentFile == NULL ) {
        HideCursor();
        return;
    }
#ifndef __WIN__
    SetGenericWindowCursor( CurrentWindow, (int) (CurrentPos.line - LeftTopPos.line + 1),
                            VirtualColumnOnCurrentLine( CurrentPos.column ) - LeftTopPos.column );
#else
    // for windows assume tabs to be of lenght 1
    if( !EditFlags.RealTabs ){
        SetGenericWindowCursor( CurrentWindow, (int) (CurrentPos.line - LeftTopPos.line + 1),
                                VirtualColumnOnCurrentLine( CurrentPos.column ) - LeftTopPos.column );
    } else {

        SetGenericWindowCursor( CurrentWindow, (int) (CurrentPos.line - LeftTopPos.line + 1),
                                VirtualColumnOnCurrentLine( CurrentPos.column ) );
    }
#endif

    cursorNeedsDisplay = false;

} /* SetWindowCursorForReal */
Пример #5
0
/*
 * Clear from cursor position to beginning of display, inclusive.
 */
static void
ClearAbove (register TScreen *screen)
{
	if (screen->protected_mode != OFF_PROTECT) {
		register int row;
		for (row = 0; row <= screen->max_row; row++)
			ClearInLine(screen, row, 0, screen->max_col + 1);
	} else {
		register int top, height;

		if(screen->cursor_state)
			HideCursor();
		if((top = -screen->topline) <= screen->max_row) {
			if(screen->scroll_amt)
				FlushScroll(screen);
			if((height = screen->cur_row + top) > screen->max_row)
				height = screen->max_row;
			if((height -= top) > 0) {
				ClearCurBackground(screen,
				    top * FontHeight(screen) + screen->border,
				    OriginX(screen),
				    height * FontHeight(screen),
				    Width(screen));
			}
		}
		ClearBufRows(screen, 0, screen->cur_row - 1);
	}

	if(screen->cur_row - screen->topline <= screen->max_row)
		ClearLeft(screen);
}
Пример #6
0
//-----------------------------------------------------------------------------
// name: main_motion()
// desc: ...
//-----------------------------------------------------------------------------
void AudicleWindow::main_motion( int x, int y )
{
    assert( this == AudicleWindow::main() );
    set_mouse_coords(x,y);

//XXX
#ifdef MACOSX
    if ( 0 < x && x < m_cur_vp[2] && 0 < y && y < m_cur_vp[3] ) { 
        if ( cursorOn ) { 
            HideCursor();
            cursorOn = false;
        }
    }
    else { 
        if ( !cursorOn ) { 
            ShowCursor();
            cursorOn = true;
        }
    }
#endif

    InputEvent * ev = new InputEvent ( ae_input_MOTION, m_cur_pt );
    ev->time = get_current_time();

    AudicleEvent event;
    event.type = ae_event_INPUT;
    event.message = 2;
    event.data = (void *) ev;

    Audicle::instance()->face()->on_event( event );

    delete ev; //XXX assumes unqueued...

}
Пример #7
0
// Gameplay Screen Draw logic
void DrawGameplayScreen(void)
{
    // TODO: Draw GAMEPLAY screen here!
    
    HideCursor();
    
    // Background
    DrawTextureEx(bg, Vector2Zero(), 0, 10, WHITE);
    
    // Ground
    DrawRectangle(0, groundPositionY, GetScreenWidth(), 1, RED);
   
    DrawPlayer(player);
    
    // Draw triangles 
    for (int i=0; i<maxTriangles; i++)
    {
        if (triangles[i].isActive) DrawObjectOnCameraPosition(triangleTexture, triangles[i].position);
    }
    
    for (int i=0; i<maxPlatforms; i++)
    {
        if (platforms[i].isActive) DrawObjectOnCameraPosition(platformTexture, platforms[i].position);
        //if (platforms[i].isActive) DrawRectangleRec(platforms[i].collider, RED);
    }
    
    if (!startGame) DrawText ("PRESS SPACE", 20, GetScreenHeight()-30, 15, WHITE);
}
Пример #8
0
/*
 * Reverse scrolls the screen by amount lines, erases top, doesn't alter
 * cursor position (i.e. cursor moves up amount relative to text).
 * All done within the scrolling region, of course.
 * Requires: amount > 0
 */
void
RevScroll(register TScreen *screen, register int amount)
{
	register int i = screen->bot_marg - screen->top_marg + 1;
	register int shift;
	register int bot;
	register int refreshtop;
	register int refreshheight;
	register int scrolltop;
	register int scrollheight;

	if(screen->cursor_state)
		HideCursor();
	if (amount > i)
		amount = i;
    if(screen->jumpscroll) {
	if(screen->scroll_amt < 0) {
		if(-screen->refresh_amt + amount > i)
			FlushScroll(screen);
		screen->scroll_amt -= amount;
		screen->refresh_amt -= amount;
	} else {
		if(screen->scroll_amt > 0)
			FlushScroll(screen);
		screen->scroll_amt = -amount;
		screen->refresh_amt = -amount;
	}
    } else {
	shift = -screen->topline;
	bot = screen->max_row - shift;
	refreshheight = amount;
	scrollheight = screen->bot_marg - screen->top_marg -
	 refreshheight + 1;
	refreshtop = screen->top_marg + shift;
	scrolltop = refreshtop + refreshheight;
	if((i = screen->bot_marg - bot) > 0)
		scrollheight -= i;
	if((i = screen->top_marg + refreshheight - 1 - bot) > 0)
		refreshheight -= i;

	if (screen->multiscroll && amount == 1 &&
	    screen->topline == 0 && screen->top_marg == 0 &&
	    screen->bot_marg == screen->max_row) {
	    if (screen->incopy < 0 && screen->scrolls == 0)
		CopyWait(screen);
	    screen->scrolls++;
	}
	scrolling_copy_area(screen, scrolltop-amount, scrollheight, -amount);
	if(refreshheight > 0) {
		ClearCurBackground(screen,
		    (int) refreshtop * FontHeight(screen) + screen->border,
		    (int) OriginX(screen),
		    (unsigned) refreshheight * FontHeight(screen),
		    (unsigned) Width(screen));
	}
    }
    ScrnInsertLine(screen, screen->visbuf, screen->bot_marg, screen->top_marg,
		   amount, screen->max_col + 1);
}
Пример #9
0
static void 
show_cursor( int param1, int param2 )
{
	HideCursor();
	SetCursor( &qd.arrow );
	ShowCursor();
	m.tt_pending = 0;
}
Пример #10
0
void
WindowScroll(XtermWidget xw, int top, Bool always GCC_UNUSED)
{
    TScreen *screen = TScreenOf(xw);

#if OPT_SCROLL_LOCK
    if (screen->allowScrollLock && (screen->scroll_lock && !always)) {
	if (screen->scroll_dirty) {
	    screen->scroll_dirty = False;
	    ScrnRefresh(xw, 0, 0, MaxRows(screen), MaxCols(screen), False);
	}
    } else
#endif
    {
	int i;

	if (top < -screen->savedlines) {
	    top = -screen->savedlines;
	} else if (top > 0) {
	    top = 0;
	}

	if ((i = screen->topline - top) != 0) {
	    int lines;
	    int scrolltop, scrollheight, refreshtop;

	    if (screen->cursor_state)
		HideCursor();
	    lines = i > 0 ? i : -i;
	    if (lines > MaxRows(screen))
		lines = MaxRows(screen);
	    scrollheight = screen->max_row - lines + 1;
	    if (i > 0)
		refreshtop = scrolltop = 0;
	    else {
		scrolltop = lines;
		refreshtop = scrollheight;
	    }
	    scrolling_copy_area(xw, scrolltop, scrollheight, -i);
	    screen->topline = top;

	    ScrollSelection(screen, i, True);

	    xtermClear2(xw,
			OriginX(screen),
			OriginY(screen) + refreshtop * FontHeight(screen),
			(unsigned) Width(screen),
			(unsigned) (lines * FontHeight(screen)));
	    ScrnRefresh(xw, refreshtop, 0, lines, MaxCols(screen), False);

#if OPT_BLINK_CURS || OPT_BLINK_TEXT
	    RestartBlinking(screen);
#endif
	}
    }
    ScrollBarDrawThumb(screen->scrollWidget);
}
Пример #11
0
void DailyForecast(wstring city)
{
	WeatherInfo weather;
	int c = 0;
	ShowCursor();
	while (c < 1 || c > 16)
	{
		cls();
		Center(32, true); cout << "Input number of days to show(1-16): ";
		string temp;
		cin >> temp;
		if (!((temp[0] < 48 || temp[0] > 57) && (temp[1] < 48 || temp[0] > 57)))
			c = stoi(temp.substr(0,2));
	}
	HideCursor();
	wchar_t count[3];
	_itow_s(c, count, 10);
	auto result(async(SendRequest, L"forecast/daily?q=" + city + L"&cnt=" + count));
	cls();
	Center(16, true); cout << "Fetching data";
	cursorPos = getCursorPos();
	for (int i = 0; result.wait_for(span) != future_status::ready; i++)
	{
		SetConsoleCursorPosition(ConsoleH, cursorPos);
		switch (i % 4)
		{
		case 0:
			cout << "   ";
			break;
		case 1:
			cout << ".  ";
			break;
		case 2:
			cout << ".. ";
			break;
		case 3:
			cout << "...";
		}
		if (i > 50)
		{
			Center(16, true);
			cout << "  Fetch failed  ";
			SetConsoleTextAttribute(ConsoleH, 240);
			Center(4, 4);
			cout << "Back";
			SetConsoleTextAttribute(ConsoleH, 15);
			while (_getch() != 13);
			return;
		}
	}
	weather = ParseDaily(result.get());
	auto weatherI = DayMenu(weather);
	if (weatherI.main == "back")
		return;
	PrintDaily(weatherI, weather.cityName);
}
Пример #12
0
int main()
{
	ResizeWindow(800, 600);
	SetConsoleTitle(TEXT("Weather Forecast"));
	HideCursor();
	PrintTitle();
	bool quit;
	for (;;)
	{
		wstring city;
		switch (InitMenu())
		{
			case 0:

				quit = false;
				cls();
				Center(25, true); cout << "Enter city name: ";
				ShowCursor();
				while (city.size() == 0)
					Input(city);
				HideCursor();
				while (!quit)
					switch (MainMenu())
					{
						case 0:
							CurrentWeather(city);
							break;
						case 1:
							FiveDayForecast(city);
							break;
						case 2:
							DailyForecast(city);
							break;
						case 3:
							quit = true;
					}
				break;
			case 1:
				return 0;
		}
	}
}
void OpenGLWindow::mousePressEvent(QMouseEvent * e)
{
	if (!focused) return;

	if (e->button() == Qt::MouseButton::RightButton) {
		HideCursor();
		CenterCursor();
	}

	MouseEvent(e, GLFW_PRESS);
}
Пример #14
0
void show_data(int n)
{
	if (!stamp_data[n])
		return;

	sssR = &stampingR[n];

	HideCursor();
	(*showers[stamp_data[n]->dimension - 1]) (stamp_data[n]);
	ShowCursor();
}
Пример #15
0
static void
repaint_line(XtermWidget xw, unsigned newChrSet)
{
    TScreen *screen = TScreenOf(xw);
    LineData *ld;
    int curcol = screen->cur_col;
    int currow = screen->cur_row;
    int width = MaxCols(screen);
    unsigned len = (unsigned) width;

    assert(width > 0);

    /*
     * Ignore repetition.
     */
    if (!IsLeftRightMode(xw)
	&& (ld = getLineData(screen, currow)) != 0) {
	unsigned oldChrSet = GetLineDblCS(ld);

	if (oldChrSet != newChrSet) {
	    TRACE(("repaint_line(%2d,%2d) (%s -> %s)\n", currow, screen->cur_col,
		   visibleDblChrset(oldChrSet),
		   visibleDblChrset(newChrSet)));
	    HideCursor();

	    /* If switching from single-width, keep the cursor in the visible part
	     * of the line.
	     */
	    if (CSET_DOUBLE(newChrSet)) {
		width /= 2;
		if (curcol > width)
		    curcol = width;
	    }

	    /*
	     * ScrnRefresh won't paint blanks for us if we're switching between a
	     * single-size and double-size font.  So we paint our own.
	     */
	    ClearCurBackground(xw,
			       currow,
			       0,
			       1,
			       len,
			       (unsigned) LineFontWidth(screen, ld));

	    SetLineDblCS(ld, newChrSet);

	    set_cur_col(screen, 0);
	    ScrnUpdate(xw, currow, 0, 1, (int) len, True);
	    set_cur_col(screen, curcol);
	}
    }
}
Пример #16
0
/*
 * If cursor not in scrolling region, returns.  Else,
 * inserts n blank lines at the cursor's position.  Lines above the
 * bottom margin are lost.
 */
void
InsertLine (register TScreen *screen, register int n)
{
	register int i;
	register int shift;
	register int bot;
	register int refreshtop;
	register int refreshheight;
	register int scrolltop;
	register int scrollheight;

	if (screen->cur_row < screen->top_marg ||
	 screen->cur_row > screen->bot_marg)
		return;
	if(screen->cursor_state)
		HideCursor();
	screen->do_wrap = 0;
	if (n > (i = screen->bot_marg - screen->cur_row + 1))
		n = i;
    if(screen->jumpscroll) {
	if(screen->scroll_amt <= 0 &&
	 screen->cur_row <= -screen->refresh_amt) {
		if(-screen->refresh_amt + n > screen->max_row + 1)
			FlushScroll(screen);
		screen->scroll_amt -= n;
		screen->refresh_amt -= n;
	} else if(screen->scroll_amt)
		FlushScroll(screen);
    }
    if(!screen->scroll_amt) {
	shift = -screen->topline;
	bot = screen->max_row - shift;
	refreshheight = n;
	scrollheight = screen->bot_marg - screen->cur_row - refreshheight + 1;
	refreshtop = screen->cur_row + shift;
	scrolltop = refreshtop + refreshheight;
	if((i = screen->bot_marg - bot) > 0)
		scrollheight -= i;
	if((i = screen->cur_row + refreshheight - 1 - bot) > 0)
		refreshheight -= i;
	vertical_copy_area(screen, scrolltop-n, scrollheight, -n);
	if(refreshheight > 0) {
		ClearCurBackground(screen,
		    (int) refreshtop * FontHeight(screen) + screen->border,
		    (int) OriginX(screen),
		    (unsigned) refreshheight * FontHeight(screen),
		    (unsigned) Width(screen));
	}
    }
    ScrnInsertLine(screen, screen->visbuf, screen->bot_marg, screen->cur_row, n,
		   screen->max_col + 1);
}
Пример #17
0
void WindowScroll(TScreen *screen,int top)
{
    register int i, lines;
    register int scrolltop, scrollheight, refreshtop;
    register int x = 0;

    if (top < -screen->savedlines)
        top = -screen->savedlines;
    else if (top > 0)
        top = 0;
    if((i = screen->topline - top) == 0)
    {
        ScrollBarDrawThumb(screen->scrollWidget);
        return;
    }

    /*ScrollSelection(screen, i);*/

    if(screen->cursor_state)
        HideCursor();
    lines = i > 0 ? i : -i;
    if(lines > screen->max_row + 1)
        lines = screen->max_row + 1;
    scrollheight = screen->max_row - lines + 1;
    if(i > 0)
        refreshtop = scrolltop = 0;
    else
    {
        scrolltop = lines;
        refreshtop = scrollheight;
    }
    /*x = screen->scrollbar + screen->border;*/
    x=OriginX(screen);

    scrolling_copy_area(screen, scrolltop, scrollheight, -i);
    screen->topline = top;

    ScrollSelection(screen, i);

    XClearArea(
        screen->display,
        /*TextWindow(screen),*/
        VWindow(screen),
        (int) x,
        (int) refreshtop * FontHeight(screen) + screen->border,
        (unsigned) Width(screen),
        (unsigned) lines * FontHeight(screen),
        FALSE);
    ScrnRefresh(screen, refreshtop, 0, lines, screen->max_col + 1, False);

    ScrollBarDrawThumb(screen->scrollWidget);
}
Пример #18
0
/**
**  Realize video memory.
*/
void RealizeVideoMemory(void)
{
	if (UseOpenGL) {
		SDL_GL_SwapBuffers();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	} else {
		if (NumRects) {
			SDL_UpdateRects(TheScreen, NumRects, Rects);
			NumRects = 0;
		}
	}
	HideCursor();
}
Пример #19
0
/**
**	Remove old cursor from display.
*/
global int HideAnyCursor(void)
{
    if( RectangleCursor || BuildingCursor ) {
	MustRedraw|=RedrawMap;
    }

    //
    //	Cursor complete on map and map must be redrawn, no restore.
    //
    if( OldCursorX>MAP_X
	    && OldCursorX+OldCursorW<MAP_X+MapWidth*TileSizeX
	    && OldCursorY>MAP_Y
	    && OldCursorY+OldCursorH<MAP_Y+MapHeight*TileSizeY ) {
	if( !(MustRedraw&RedrawMap) ) {
	    HideCursor();
	    return 1;
	}
	return 0;
    }
    HideCursor();
    return 1;
}
Пример #20
0
static void mousecapture(BOOL capture) {

	Point	cp;

	if (capture) {
		HideCursor();
		getmaincenter(&cp);
		SetMouse(&cp);
	}
	else {
		ShowCursor();
	}
}
Пример #21
0
void App::Login() {
    struct passwd *pw;
    pid_t pid;

    pw = LoginPanel->GetInput()->GetPasswdStruct();
    if(pw == 0)
        return;

    // Create new process
    pid = fork();
    if(pid == 0) {
        // Login process starts here
        SwitchUser Su(pw, &cfg, DisplayName);
        string session = LoginPanel->getSession();
        Su.Login(cfg.getLoginCommand(session).c_str());
        exit(OK_EXIT);
    }

#ifndef XNEST_DEBUG
    CloseLog();
#endif

    // Wait until user is logging out (login process terminates)
    pid_t wpid = -1;
    int status;
    while (wpid != pid) {
        wpid = wait(&status);
    }
    if (WIFEXITED(status) && WEXITSTATUS(status)) {
        LoginPanel->Message("Failed to execute login command");
    }

    // Close all clients
    KillAllClients(False);
    KillAllClients(True);

    // Send HUP signal to clientgroup
    killpg(pid, SIGHUP);

    // Send TERM signal to clientgroup, if error send KILL
    if(killpg(pid, SIGTERM))
    killpg(pid, SIGKILL);

    HideCursor();

#ifndef XNEST_DEBUG
    // Re-activate log file
    OpenLog();
#endif
}
static void WindowResize(int X, int Y)
{
    if (Focused && Reading)
        HideCursor();
    ClientSize.x = X / CharSize.x;
    ClientSize.y = Y / CharSize.y;
    Range.x = Max(0, _ScreenSize.x - ClientSize.x);
    Range.y = Max(0, _ScreenSize.y - ClientSize.y);
    _Origin.x = Min(_Origin.x, Range.x);
    _Origin.y = Min(_Origin.y, Range.y);
    SetScrollBars();
    if (Focused && Reading)
        ShowCursor();
}
CPaintCursorAppView::~CPaintCursorAppView()
    {
    if ( iMouseInitialized )
        {
        HideCursor();
        }

    // Close the animation object
    iClientCommander.Close ();

    // Close the animation server
    iMouseCursorDll.Close();
    
    RProperty::Delete( KPSUidBthidSrv, KBTMouseCursorState );
    }
Пример #24
0
static void
repaint_line(unsigned newChrSet)
{
    register TScreen *screen = &term->screen;
    int curcol = screen->cur_col;
    int currow = screen->cur_row;
    int len = screen->max_col + 1;
    int width = len;
    unsigned oldChrSet = SCRN_BUF_CSETS(screen, currow)[0];

    /*
     * Ignore repetition.
     */
    if (oldChrSet == newChrSet)
	return;

    TRACE(("repaint_line(%2d,%2d) (%d)\n", currow, screen->cur_col, newChrSet));
    HideCursor();

    /* If switching from single-width, keep the cursor in the visible part
     * of the line.
     */
    if (CSET_DOUBLE(newChrSet)) {
	width /= 2;
	if (curcol > width)
	    curcol = width;
    }

    /*
     * ScrnRefresh won't paint blanks for us if we're switching between a
     * single-size and double-size font.
     */
    if (CSET_DOUBLE(oldChrSet) != CSET_DOUBLE(newChrSet)) {
	ClearCurBackground(
			      screen,
			      CursorY(screen, currow),
			      CurCursorX(screen, currow, 0),
			      FontHeight(screen),
			      len * CurFontWidth(screen, currow));
    }

    /* FIXME: do VT220 softchars allow double-sizes? */
    memset(SCRN_BUF_CSETS(screen, currow), newChrSet, len);

    screen->cur_col = 0;
    ScrnRefresh(screen, currow, 0, 1, len, True);
    screen->cur_col = curcol;
}
Пример #25
0
int Mac_ShowWMCursor(_THIS, WMcursor *cursor)
{
	if ( cursor == NULL ) {
		if ( Mac_cursor_showing ) {
			HideCursor();
			Mac_cursor_showing = 0;
		}
	} else {
		SetCursor(&cursor->curs);
		if ( ! Mac_cursor_showing ) {
			ShowCursor();
			Mac_cursor_showing = 1;
		}
	}
	return(1);
}
Пример #26
0
//*****************************************************************************************
void CCreditsScreen::OnKeyDown(
//
//Params:
	const UINT dwTagNo, const SDL_KeyboardEvent &Key)
{ 
	HideCursor();

	CScreen::OnKeyDown(dwTagNo,Key); //For alt-F4, F10, etc.
	if (IsDeactivating()) {ShowCursor(); return;}

	 //Ignore control keys below if song is playing.
	 if (!this->pScrollingText->IsVisible()) return;

	//Check for other keys.
	switch (Key.keysym.sym)
	{
		case SDLK_PAUSE:
			//pause animation
			this->bPaused = true;
			SetRate(0);
			break;
		case SDLK_SPACE:
			//toggle pause animation unless song is playing.
			this->bPaused = !this->bPaused;
			SetRate(this->bPaused ? 0 : this->fScrollRateMultiplier);
			break;
		case SDLK_KP2: case SDLK_DOWN:
			//increase scroll rate
			this->bPaused = false;
			if (this->fScrollRateMultiplier < 5.0f) this->fScrollRateMultiplier += 0.10f;
			SetRate(this->fScrollRateMultiplier);
			break;
		case SDLK_KP8: case SDLK_UP:
			//slow scroll rate
			this->bPaused = false;
			if (this->fScrollRateMultiplier > 0.15f) this->fScrollRateMultiplier -= 0.10f;
			SetRate(this->fScrollRateMultiplier);
			break;
		default:
			//unpause
			this->bPaused = false;
			SetRate(this->fScrollRateMultiplier);
			break;
	}
}
Пример #27
0
void CCrystalEditView::ShowDropIndicator(const CPoint &point)
{
	if (! m_bDropPosVisible)
	{
		HideCursor();
		m_ptSavedCaretPos = GetCursorPos();
		m_bDropPosVisible = TRUE;
		::CreateCaret(m_hWnd, (HBITMAP) 1, 2, GetLineHeight());
	}
	m_ptDropPos = ClientToText(point);
	if (m_ptDropPos.x >= m_nOffsetChar)
	{
		SetCaretPos(TextToClient(m_ptDropPos));
		ShowCaret();
	}
	else
	{
		HideCaret();
	}
}
Пример #28
0
 int main()
 {
     int rt;HideCursor(); //隐藏控制台的光标
     HWND hwnd=FindWindow("ConsoleWindowClass",NULL);/* 控制台窗口句柄 */
     hInput = GetStdHandle(STD_INPUT_HANDLE); /* 输入设备句柄 */
     while(1)
     {
          ReadConsoleInput(hInput, &inRec, 1, &numRead); /* 读取1个输入事件 */
          switch(inRec.EventType)
 {
     case MOUSE_EVENT:
         { rt=input(); switch(rt)
 {
    case 1:printf("%d %d\n",X,Y); break;
   break;
 }
         } break;
 }
     }
 }
Пример #29
0
/* This method is use the old, opengl 2.0 context creation method */
void CreateSceneCompatible(int width, int height, int mode) {
    int conf[] = {GLX_DOUBLEBUFFER, True,
                  GLX_RGBA,
                  GLX_DEPTH_SIZE, 12,
                  GLX_RED_SIZE, 1,
                  GLX_BLUE_SIZE, 1,
                  GLX_GREEN_SIZE, 1,
                  None
                 };
    XSetWindowAttributes  swa;
    XVisualInfo          *visual;
    Atom                  fullscreen;

    cg_display       = XOpenDisplay(NULL);
    visual        = glXChooseVisual(cg_display, DefaultScreen(cg_display), conf);
    cg_screen_mode   = mode;

    cg_context       = glXCreateContext(cg_display, visual, NULL, True);
    swa.colormap     = XCreateColormap(cg_display, RootWindow(cg_display, visual->screen), visual->visual, AllocNone);
    swa.border_pixel = 0;
    swa.event_mask   = ExposureMask | StructureNotifyMask |
                       ButtonPressMask | Button1MotionMask | KeyPressMask;
    cg_window        = XCreateWindow(cg_display, RootWindow(cg_display, visual->screen),
                                     0, 0, width, height, 0, visual->depth, InputOutput,
                                     visual->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);

    if(mode == CG_FULLSCREEN) {
        /* Set to fullscreen */
        fullscreen = XInternAtom(cg_display, "_NET_WM_STATE_FULLSCREEN", False);
        XChangeProperty(cg_display, cg_window, XInternAtom(cg_display, "_NET_WM_STATE", False),
                        XA_ATOM, 32, PropModeReplace,
                        (unsigned char *)&fullscreen, 1);

        HideCursor();
        /* Get the current screen size and set the new one */
        SetScreenSize(width, height, visual);
    }

    glXMakeCurrent(cg_display, cg_window, cg_context);
    XMapWindow(cg_display, cg_window);
}
Пример #30
0
void drawChargeButton(void)
{
   /* This one is a bit sneaky. We might not have a single charge... */
   int i;

   HideCursor();
   set_samecharges();
   if (samecharges)
   {
      if (charge_thing == DIFFERENT)
      {
         RasterOp(zREPz);
         PenColor(BLUE);
         PaintRect(&chargeR);
         tools[0].t->value = chargeunit;
   		CreateNumberToolTitle(tools[0].t, tools[0].text,WHITE,BLUE);
         mainR[5] = &tools[0].t->TB.nR;
         mainR[6] = &tools[0].t->mR;
         mainR[7] = &tools[0].t->pR;
      }
      else
         drawone(&ChargeTool,chargeunit);
      charge_thing = SAME;
   }
   else
   {
      if (charge_thing == SAME)
      {
         rect R = chargeR;
         RasterOp(zREPz);
         InsetRect(&R,-2,0);
         PenColor(BLUE);
         PaintRect(&R);
         PaintRadioButton(&chargeR,false,false,chargemsg);
         for(i=0;i<3;i++)
            mainR[i+5] = &chargeR;
      }
      charge_thing = DIFFERENT;
   }
   ShowCursor();
}