コード例 #1
0
emX11WindowPort::~emX11WindowPort()
{
	int i;

	// When modifying this, the implementation of WindowFlagsChanged
	// may have to be modified too.

	SetModalState(false);
	if (FullscreenUpdateTimer) {
		delete FullscreenUpdateTimer;
		FullscreenUpdateTimer=NULL;
	}
	if (Screen.GrabbingWinPort==this) Screen.GrabbingWinPort=NULL;
	for (i=Screen.WinPorts.GetCount()-1; i>=0; i--) {
		if (Screen.WinPorts[i]==this) {
			Screen.WinPorts.Remove(i);
			break;
		}
	}
	XMutex.Lock();
	XFreeGC(Disp,Gc);
	XMutex.Unlock();
	Gc=NULL;
	if (InputContext) {
		XMutex.Lock();
		XDestroyIC(InputContext);
		XMutex.Unlock();
		InputContext=NULL;
	}
	Screen.WCThread->RemoveWindow(Win);
	XMutex.Lock();
	XDestroyWindow(Disp,Win);
	XMutex.Unlock();
	Win=None;
}
コード例 #2
0
bool pawsQuestRewardWindow::OnButtonPressed(int /*mouseButton*/, int /*keyModifier*/, pawsWidget* widget)
{
    switch( widget->GetID() )
    {
        case VIEW_BUTTON:
        {
            int row = rewardList->GetSelectedRowNum();
            if (row>=0)
            {
                // view item description (using pawsItemDescriptionWindow)
                pawsSlot* itemSlot = (pawsSlot*)rewardList->GetRow(row)->GetColumn(COLUMN_ICON);

                csString icon;
                if(itemSlot->Image())
                    icon = itemSlot->Image()->GetName();
                else
                    icon = "Standard Background";

                csString name = rewardList->GetTextCell(row, COLUMN_NAME)->GetText();
                csString desc = rewardList->GetTextCell(row, COLUMN_DESC)->GetText();

                pawsItemDescriptionWindow* itemDescWindow = (pawsItemDescriptionWindow*)PawsManager::GetSingleton().FindWidget("ItemDescWindow");
                itemDescWindow->ShowItemDescription(desc, name, icon,1); // This sets count to 1, is it possible to give more than 1 in reward?
            }
            break;
        }

        case GET_BUTTON:
        {
            int row = rewardList->GetSelectedRowNum();
            if (row>=0)
            {
                // let questmanager know that the client has wants this
                // item as a reward
                csString item = rewardList->GetTextCell(row, COLUMN_ID)->GetText();
                psQuestRewardMessage message(0, item, psQuestRewardMessage::selectReward);
                msgqueue->SendMessage(message.msg);
                SetModalState(false);
                Hide();
            }
            break;
        }
    }
    return true;
}
コード例 #3
0
void emX11WindowPort::WindowFlagsChanged()
{
	int i;

	SetModalState(false);
	if (FullscreenUpdateTimer) {
		delete FullscreenUpdateTimer;
		FullscreenUpdateTimer=NULL;
	}
	if (Screen.GrabbingWinPort==this) Screen.GrabbingWinPort=NULL;
	XMutex.Lock();
	XFreeGC(Disp,Gc);
	XMutex.Unlock();
	Gc=NULL;
	if (InputContext) {
		XMutex.Lock();
		XDestroyIC(InputContext);
		XMutex.Unlock();
		InputContext=NULL;
	}
	Screen.WCThread->RemoveWindow(Win);
	XMutex.Lock();
	XDestroyWindow(Disp,Win);
	XMutex.Unlock();
	Win=None;

	PreConstruct();

	for (i=0; i<Screen.WinPorts.GetCount(); i++) {
		if (
			Screen.WinPorts[i]->Owner==this &&
			Screen.WinPorts[i]->Win!=None
		) {
			XMutex.Lock();
			XSetTransientForHint(Disp,Screen.WinPorts[i]->Win,Win);
			XMutex.Unlock();
		}
	}
}
コード例 #4
0
void emX11WindowPort::PostConstruct()
{
	int i,r;

	if ((GetWindowFlags()&(
		emWindow::WF_POPUP|emWindow::WF_UNDECORATED|emWindow::WF_FULLSCREEN
	))!=0) {
		XMutex.Lock();
		XMapRaised(Disp,Win);
		XMutex.Unlock();
	}
	else {
		XMutex.Lock();
		XMapWindow(Disp,Win);
		XMutex.Unlock();
	}

	if (Focused) {
		if (MakeViewable()) {
			if ((GetWindowFlags()&emWindow::WF_MODAL)!=0 && Owner) {
				XMutex.Lock();
				XSetInputFocus(Disp,Win,RevertToParent,CurrentTime);
				XMutex.Unlock();
			}
			else {
				XMutex.Lock();
				XSetInputFocus(Disp,Win,RevertToNone,CurrentTime);
				XMutex.Unlock();
			}
		}
		else {
			Focused=false;
			SetViewFocused(false);
		}
	}

	if (
		(GetWindowFlags()&emWindow::WF_FULLSCREEN)!=0 ||
		(
			(GetWindowFlags()&emWindow::WF_POPUP)!=0 &&
			(
				!Screen.GrabbingWinPort ||
				(Screen.GrabbingWinPort->GetWindowFlags()&emWindow::WF_FULLSCREEN)==0
			)
		)
	) {
		if (MakeViewable()) {
			for (i=0; ; i++) {
				XMutex.Lock();
				r=XGrabKeyboard(
					Disp,
					Win,
					True,
					GrabModeSync,
					GrabModeAsync,
					CurrentTime
				);
				XMutex.Unlock();
				if (r==GrabSuccess) break;
				if (i>10) emFatalError("XGrabKeyboard failed.");
				emWarning("XGrabKeyboard failed - trying again...");
				emSleepMS(50);
			}
			for (i=0; ; i++) {
				XMutex.Lock();
				r=XGrabPointer(
					Disp,
					Win,
					True,
					ButtonPressMask|ButtonReleaseMask|PointerMotionMask|
					ButtonMotionMask|EnterWindowMask|LeaveWindowMask,
					GrabModeSync,
					GrabModeAsync,
					(GetWindowFlags()&emWindow::WF_FULLSCREEN)!=0 ? Win : None,
					None,
					CurrentTime
				);
				XMutex.Unlock();
				if (r==GrabSuccess) break;
				if (i>10) emFatalError("XGrabPointer failed.");
				emWarning("XGrabPointer failed - trying again...");
				emSleepMS(50);
			}
			XMutex.Lock();
			XAllowEvents(Disp,SyncPointer,CurrentTime);
			XMutex.Unlock();
			Screen.GrabbingWinPort=this;
		}
	}

	if ((GetWindowFlags()&emWindow::WF_FULLSCREEN)!=0) {
		FullscreenUpdateTimer=new emTimer(GetScheduler());
		AddWakeUpSignal(FullscreenUpdateTimer->GetSignal());
		FullscreenUpdateTimer->Start(500,true);
	}

	if ((GetWindowFlags()&emWindow::WF_MODAL)!=0) {
		SetModalState(true);
	}
}