void
TBarView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
{
	if (fDragRegion->IsDragging()) {
		fDragRegion->MouseMoved(where, transit, dragMessage);
		return;
	}

	if (transit == B_ENTERED_VIEW && EventMask() == 0)
		SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);

	desk_settings* settings = ((TBarApp*)be_app)->Settings();
	bool alwaysOnTop = settings->alwaysOnTop;
	bool autoRaise = settings->autoRaise;
	bool autoHide = settings->autoHide;

	if (!autoRaise && !autoHide) {
		if (transit == B_EXITED_VIEW || transit == B_OUTSIDE_VIEW)
			SetEventMask(0);
		return;
	}

	bool isTopMost = Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL;

	// Auto-Raise
	where = ConvertToScreen(where);
	BRect screenFrame = (BScreen(Window())).Frame();
	if ((where.x == screenFrame.left || where.x == screenFrame.right
			|| where.y == screenFrame.top || where.y == screenFrame.bottom)
		&& Window()->Frame().Contains(where)) {
		// cursor is on a screen edge within the window frame

		if (!alwaysOnTop && autoRaise && !isTopMost)
			RaiseDeskbar(true);

		if (autoHide && IsHidden())
			HideDeskbar(false);

	} else {
		TBarWindow* window = (TBarWindow*)Window();
		if (window->IsShowingMenu())
			return;

		// cursor is not on screen edge
		BRect preventHideArea = Window()->Frame().InsetByCopy(
			-kMaxPreventHidingDist, -kMaxPreventHidingDist);

		if (preventHideArea.Contains(where))
			return;

		// cursor to bar distance above threshold
		if (!alwaysOnTop && autoRaise && isTopMost) {
			RaiseDeskbar(false);
			SetEventMask(0);
		}

		if (autoHide && !IsHidden())
			HideDeskbar(true);
	}
}
Example #2
0
/*
=============
InitMacStuff
=============
*/
void InitMacStuff( void ) {
	Handle 		menuBar;
	char		dir[MAX_OSPATH];
	
	// init toolbox
	MaxApplZone();
	MoreMasters();
	
	InitGraf(&qd.thePort);
	InitFonts();
	FlushEvents(everyEvent, 0);
	SetEventMask( -1 );
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(nil);
	InitCursor();

	// init menu
	menuBar = GetNewMBar(rMenuBar);
	if(!menuBar) {
		Com_Error( ERR_FATAL, "MenuBar not found.");
	}
	
	SetMenuBar(menuBar);
	DisposeHandle(menuBar);
	AppendResMenu(GetMenuHandle(mApple),'DRVR');
	DrawMenuBar();

	Sys_InitConsole();

	SetEventMask( -1 );
}
Example #3
0
int PollEngine::DispatchEvents()
{
	int i = poll(events, CurrentSetSize, 1000);
	int index;
	socklen_t codesize = sizeof(int);
	int errcode;
	int processed = 0;
	ServerInstance->UpdateTime();

	if (i > 0)
	{
		for (index = 0; index < CurrentSetSize && processed != i; index++)
		{
			if (events[index].revents)
				processed++;
			EventHandler* eh = ref[index];
			if (!eh)
				continue;

			if (events[index].revents & POLLHUP)
			{
				eh->HandleEvent(EVENT_ERROR, 0);
				continue;
			}

			if (events[index].revents & POLLERR)
			{
				// Get fd
				int fd = events[index].fd;

				// Get error number
				if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0)
					errcode = errno;
				eh->HandleEvent(EVENT_ERROR, errcode);
				continue;
			}

			if (events[index].revents & POLLIN)
			{
				SetEventMask(eh, eh->GetEventMask() & ~FD_READ_WILL_BLOCK);
				eh->HandleEvent(EVENT_READ);
				if (eh != ref[index])
					// whoops, deleted out from under us
					continue;
			}
			
			if (events[index].revents & POLLOUT)
			{
				int mask = eh->GetEventMask();
				mask &= ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE);
				SetEventMask(eh, mask);
				events[index].events = mask_to_poll(mask);
				eh->HandleEvent(EVENT_WRITE);
			}
		}
	}

	return i;
}
Example #4
0
void
TBarView::UpdateAutoRaise()
{
	if (((TBarApp*)be_app)->Settings()->autoRaise)
		SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	else
		SetEventMask(0);
}
Example #5
0
// SetPopupWindow
void
PopupView::SetPopupWindow(PopupWindow* window)
{
	fWindow = window;
	if (fWindow)
		SetEventMask(B_POINTER_EVENTS);
	else
		SetEventMask(0);
}
int SelectEngine::DispatchEvents()
{
	static timeval tval = { 1, 0 };

	fd_set rfdset = ReadSet, wfdset = WriteSet, errfdset = ErrSet;

	int sresult = select(MaxFD + 1, &rfdset, &wfdset, &errfdset, &tval);
	ServerInstance->UpdateTime();

	/* Nothing to process this time around */
	if (sresult < 1)
		return 0;

	for (int i = 0, j = sresult; i <= MaxFD && j > 0; i++)
	{
		int has_read = FD_ISSET(i, &rfdset), has_write = FD_ISSET(i, &wfdset), has_error = FD_ISSET(i, &errfdset);

		if (has_read || has_write || has_error)
		{
			--j;

			EventHandler* ev = ref[i];
			if (!ev)
				continue;

			if (has_error)
			{
				ErrorEvents++;

				socklen_t codesize = sizeof(int);
				int errcode = 0;
				if (getsockopt(i, SOL_SOCKET, SO_ERROR, (char*)&errcode, &codesize) < 0)
					errcode = errno;

				ev->HandleEvent(EVENT_ERROR, errcode);
				continue;
			}

			if (has_read)
			{
				ReadEvents++;
				SetEventMask(ev, ev->GetEventMask() & ~FD_READ_WILL_BLOCK);
				ev->HandleEvent(EVENT_READ);
				if (ev != ref[i])
					continue;
			}
			if (has_write)
			{
				WriteEvents++;
				SetEventMask(ev, ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE));
				ev->HandleEvent(EVENT_WRITE);
			}
		}
	}

	return sresult;
}
int KQueueEngine::DispatchEvents()
{
	ts.tv_nsec = 0;
	ts.tv_sec = 1;

	int i = kevent(EngineHandle, NULL, 0, &ke_list[0], ke_list.size(), &ts);
	ServerInstance->UpdateTime();

	if (i < 0)
		return i;

	TotalEvents += i;

	for (int j = 0; j < i; j++)
	{
		struct kevent& kev = ke_list[j];

		EventHandler* eh = GetRef(kev.ident);
		if (!eh)
			continue;

		if (kev.flags & EV_EOF)
		{
			ErrorEvents++;
			eh->HandleEvent(EVENT_ERROR, kev.fflags);
			continue;
		}
		if (kev.filter == EVFILT_WRITE)
		{
			WriteEvents++;
			/* When mask is FD_WANT_FAST_WRITE or FD_WANT_SINGLE_WRITE,
			 * we set a one-shot write, so we need to clear that bit
			 * to detect when it set again.
			 */
			const int bits_to_clr = FD_WANT_SINGLE_WRITE | FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK;
			SetEventMask(eh, eh->GetEventMask() & ~bits_to_clr);
			eh->HandleEvent(EVENT_WRITE);

			if (eh != GetRef(kev.ident))
				// whoops, deleted out from under us
				continue;
		}
		if (kev.filter == EVFILT_READ)
		{
			ReadEvents++;
			SetEventMask(eh, eh->GetEventMask() & ~FD_READ_WILL_BLOCK);
			eh->HandleEvent(EVENT_READ);
		}
	}

	return i;
}
Example #8
0
void
PositionView::SetPermanent(bool permanent)
{
	if (permanent) {
		SetEventMask(B_POINTER_EVENTS, 0);
		SetViewColor(kPermanentColor);
	} else {
		SetEventMask(0, 0);
		SetViewColor(Parent()->ViewColor());
	}

	fPermanent = permanent;

	SetLowColor(ViewColor());
	Invalidate();
}
/*
================
CSyntaxRichEditCtrl::Init
================
*/
void CSyntaxRichEditCtrl::Init(void)
{

	// get the Rich Edit ITextDocument to use the wonky TOM interface
	IRichEditOle *ire = GetIRichEditOle();
	IUnknown *iu = (IUnknown *)ire;

	if (iu == NULL || iu->QueryInterface(tom::IID_ITextDocument, (void **) &m_TextDoc) != S_OK) {
		m_TextDoc = NULL;
	}

	InitFont();

	InitSyntaxHighlighting();

	SetEventMask(GetEventMask() | ENM_CHANGE | ENM_KEYEVENTS | ENM_MOUSEEVENTS | ENM_PROTECTED);	// ENM_SCROLLEVENTS

	EnableToolTips(TRUE);

	// create auto complete list box
	CRect rect(0, 0, AUTOCOMPLETE_WIDTH, AUTOCOMPLETE_HEIGHT);
	autoCompleteListBox.Create(WS_DLGFRAME | WS_VISIBLE | WS_VSCROLL | LBS_SORT | LBS_NOTIFY, rect, this, IDC_LISTBOX_AUTOCOMPLETE);
	autoCompleteListBox.SetFont(GetParent()->GetFont());
	autoCompleteListBox.ShowWindow(FALSE);

	// create function parameter tool tip
	funcParmToolTip.Create(WS_VISIBLE | WS_BORDER, rect, this, IDC_EDITBOX_FUNCPARMS);
	funcParmToolTip.SetFont(GetParent()->GetFont());
	funcParmToolTip.ShowWindow(FALSE);
}
Example #10
0
void CEmoticonRichEditCtrl::Initialize() 
{
	PARAFORMAT pf;
	pf.cbSize = sizeof(PARAFORMAT);
	pf.dwMask = PFM_TABSTOPS ;
	pf.cTabCount = MAX_TAB_STOPS;
	for( int itab = 0 ; itab < pf.cTabCount  ; itab++ )
		pf.rgxTabs[itab] = (itab + 1) * 1440/5 ;

	SetParaFormat( pf );		

	SetEventMask(ENM_CHANGE | ENM_SELCHANGE | ENM_PROTECTED);

	//이모티콘		
	m_imgListFaces.Create(20, 20, ILC_COLOR24|ILC_MASK, 0, 1);	
	m_bmpFaces.LoadBitmap(IDB_BITMAP_EMOTICON);
	m_imgListFaces.Add(& m_bmpFaces, RGB(255, 255, 255));	

	m_pRichEditOle = GetIRichEditOle();

	DragAcceptFiles(TRUE);

	/*
	if(m_nRole == ROLE_SEND_INPUT )
	{	
		CHARFORMAT2 cf;
		GetSelectionCharFormat(cf);
		cf.dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE |CFM_PROTECTED ;		
		cf.crTextColor =  CChatSession::Instance().m_ColorMe;			
		cf.dwEffects &=(unsigned long) ~CFE_AUTOCOLOR;	
		SetDefaultCharFormat(cf);			
	}
	*/
	
}
Example #11
0
int   main(int argc,char *argv[])
{
   FILE  *f;
   if(argc>=2)
   {
      f=fopen(argv[1],"r");
      if(f==NULL)
      {
         perror(argv[1]);
         return(1);
      }
      Load(f);
      fclose(f);
   }
   else
   {
      f=fopen("field.lif","r");
      if(f!=NULL)
      {
         Load(f);
         fclose(f);
      }
   }

   OpenInterface();
   OwInitialize(root_pal);
   ShowMouse(TRUE);
   SetEventMask(KEYBOARD_EVENTS|MOUSE_EVENTS);
   OwCreate(&StatusWin,0,DOWN,1,1,status_pal);
   OwCreate(&ReadLine,MIDDLE,MIDDLE+5,60,4,readline_pal);
   Life();
   OwExit();
   CloseInterface();
   return(0);
}
Example #12
0
// ---------------------------------------------------------------------
//! Called when it starts dragging.
// ---------------------------------------------------------------------
void BeSkinView::BeginMouseCapture()
{
	if (0 == mouseCaptureNestCount)
		SetEventMask(EventMask() | B_POINTER_EVENTS);
	
	mouseCaptureNestCount++;
}
Example #13
0
void
AboutView::AttachedToWindow()
{
	BView::AttachedToWindow();
	Window()->SetPulseRate(500000);
	SetEventMask(B_POINTER_EVENTS);
}
Example #14
0
void ArpIntControl::StartEdit()
{
	// If I've lost the active state while waiting, don't start editing.
	if ( !Window() || !Window()->IsActive() ) return;
	
	StopEdit(false);
	StopTimer();
	
	BRect		b = ControlBounds();
	float		borderL = b.left;
	float		bottomIndent = 0;
	float		stringIndent = 3;
	BPoint		origin( borderL + 3, b.bottom - bottomIndent - stringIndent );
	
	if (!mTextCtrl) {
		BFont font;
		GetFont(&font);
		mTextCtrl = new ArpInlineTextView(BMessenger(this),
										  "text:edit", &font,
										  origin.x, b.right-2, origin.y);
	}
	if (!mTextCtrl) return;
	
	SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	
	mTextCtrl->MoveOver(origin.x, b.right-2, origin.y);
	mTextCtrl->SetViewColor( Prefs().GetColor(ARP_INT_BGF_C));
	mTextCtrl->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
	BString16		str;
	GetValueLabel(Value(), str);
	mTextCtrl->SetText( str.String() );
	AddChild(mTextCtrl);
}
Example #15
0
static int
MacintoshInit()
{
    MaxApplZone();
    MoreMasters();
    MoreMasters();
    MoreMasters();
    MoreMasters();

    tcl_macQdPtr = &qd;

     if (TkMacHaveAppearance()) {
         RegisterAppearanceClient();
     }

    InitGraf(&tcl_macQdPtr->thePort);
    InitFonts();

    if (TkMacHaveAppearance() >= 0x110) {
	InitFloatingWindows();
    } else {
	InitWindows();
    }

    InitMenus();
    InitDialogs((long) NULL);		
    InitCursor();

    FlushEvents(everyEvent, 0);
    SetEventMask(everyEvent);
    Tcl_MacSetEventProc(TkMacConvertEvent);

    return TCL_OK;
}
Example #16
0
// AttachedToWindow
void
PopupTextView::AttachedToWindow()
{
	MakeResizable(true, Parent());
	SelectAll();
	MakeFocus();
	SetEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
}
Example #17
0
CaptureView::CaptureView()
	:
	BView("main", 0),
	fModifierMask(B_CONTROL_KEY),
	fMovedOutWhat(0)
{
	SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY);
	_UpdateLast(BPoint(-1, -1));
}
Example #18
0
int PortsEngine::DispatchEvents()
{
	struct timespec poll_time;

	poll_time.tv_sec = 1;
	poll_time.tv_nsec = 0;

	unsigned int nget = 1; // used to denote a retrieve request.
	int ret = port_getn(EngineHandle, this->events, GetMaxFds() - 1, &nget, &poll_time);
	ServerInstance->UpdateTime();

	// first handle an error condition
	if (ret == -1)
		return -1;

	TotalEvents += nget;

	unsigned int i;
	for (i = 0; i < nget; i++)
	{
		switch (this->events[i].portev_source)
		{
			case PORT_SOURCE_FD:
			{
				int fd = this->events[i].portev_object;
				EventHandler* eh = ref[fd];
				if (eh)
				{
					int mask = eh->GetEventMask();
					if (events[i].portev_events & POLLWRNORM)
						mask &= ~(FD_WRITE_WILL_BLOCK | FD_WANT_FAST_WRITE | FD_WANT_SINGLE_WRITE);
					if (events[i].portev_events & POLLRDNORM)
						mask &= ~FD_READ_WILL_BLOCK;
					// reinsert port for next time around, pretending to be one-shot for writes
					SetEventMask(eh, mask);
					port_associate(EngineHandle, PORT_SOURCE_FD, fd, mask_to_events(mask), eh);
					if (events[i].portev_events & POLLRDNORM)
					{
						ReadEvents++;
						eh->HandleEvent(EVENT_READ);
						if (eh != ref[fd])
							continue;
					}
					if (events[i].portev_events & POLLWRNORM)
					{
						WriteEvents++;
						eh->HandleEvent(EVENT_WRITE);
					}
				}
			}
			default:
			break;
		}
	}

	return (int)i;
}
Example #19
0
void
AlertView::AttachedToWindow()
{
	// the view displays a decrementing counter
	// (until the user must take action)
	Window()->SetPulseRate(1000000);
		// every second

	SetEventMask(B_KEYBOARD_EVENTS);
}
Example #20
0
MouseView::MouseView(const MouseSettings &settings)
	:
	BView("mouse_view", B_PULSE_NEEDED | B_WILL_DRAW),
	fSettings(settings),
	fType(-1),
	fButtons(0),
	fOldButtons(0)
{
	SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	fScaling = std::max(1.0f, be_plain_font->Size() / 12.0f);
}
Example #21
0
void CRichView::OnInitialUpdate()
{
	//increase the text limit of the rich edit window
	LimitText(-1);

	//Determine which messages will be passed to the parent
	DWORD dwMask = ENM_KEYEVENTS | ENM_DROPFILES ;
	SetEventMask(dwMask);

	SetFontDefaults();
}
void CRichInfo::PreSubclassWindow()
{
  SetBackgroundColor(FALSE,GetSysColor(COLOR_3DFACE));

  // Set the control to word wrap the text
  SetTargetDevice(NULL,0);

  // Notify the parent window of the control's required size
  SetEventMask(ENM_REQUESTRESIZE);

  CRichEditCtrl::PreSubclassWindow();
}
Example #23
0
void CUrlRichEditCtrl::PreSubclassWindow() 
{
	SetEventMask(GetEventMask() | ENM_CHANGE | ENM_DROPFILES | ENM_DRAGDROPDONE );
	DragAcceptFiles();
	
	// enable multilevel undo
	SendMessage(EM_SETTEXTMODE, TM_MULTILEVELUNDO);

	m_ncBorder.Initialize(GetSafeHwnd());

	CRichEditBaseCtrl::PreSubclassWindow();
}
Example #24
0
// ---------------------------------------------------------------------
//! Called when it ends dragging.
// ---------------------------------------------------------------------
void BeSkinView::EndMouseCapture()
{
	if (mouseCaptureNestCount > 0)
	{
		mouseCaptureNestCount--;
		
		if (0 == mouseCaptureNestCount)
		{
			SetEventMask(EventMask() & ~B_POINTER_EVENTS);
		}
	}
}
Example #25
0
//创建消息
INT CSkinRichEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (__super::OnCreate(lpCreateStruct)==-1) return -1;

	//初始化控件
	SetEventMask(ENM_LINK);
	SetOptions(ECOOP_OR,ECO_NOHIDESEL);

	//获取接口
	m_pIRichEditOle=GetIRichEditOle();

	return 0;
}
Example #26
0
//控件绑定
VOID CSkinRichEdit::PreSubclassWindow()
{
	__super::PreSubclassWindow();

	//初始化控件
	SetEventMask(ENM_LINK);
	SetOptions(ECOOP_OR,ECO_NOHIDESEL);

	//获取接口
	m_pIRichEditOle=GetIRichEditOle();

	return;
}
Example #27
0
WorkspacesView::WorkspacesView(BMessage* archive)
	:
	BView(archive),
	fParentWhichDrawsOnChildren(NULL),
	fCurrentFrame(Frame())
{
	// Just in case we are instantiated from an older archive...
	SetFlags(Flags() | B_FRAME_EVENTS);
	// Make sure the auto-raise feature didn't leave any artifacts - this is
	// not a good idea to keep enabled for a replicant.
	if (EventMask() != 0)
		SetEventMask(0);
}
Example #28
0
void
VolumeControl::AttachedToWindow()
{
	BSlider::AttachedToWindow();

	if (_IsReplicant())
		SetEventMask(0, 0);
	else
		SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);

	be_roster->StartWatching(this, B_REQUEST_LAUNCHED | B_REQUEST_QUIT);

	_ConnectVolume();

	if (!fMixerControl->Connected()) {
		// Wait a bit, and try again - the media server might not have been
		// ready yet
		BMessage reconnect(kMsgReconnectVolume);
		BMessageRunner::StartSending(this, &reconnect, 1000000LL, 1);
		fConnectRetries = 3;
	}
}
Example #29
0
int CUrlRichEditCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CRichEditBaseCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	SetEventMask(GetEventMask() | ENM_CHANGE | ENM_DROPFILES | ENM_DRAGDROPDONE | ENM_LINK);
	DragAcceptFiles();
	
	// enable multilevel undo
	SendMessage(EM_SETTEXTMODE, TM_MULTILEVELUNDO);

	m_ncBorder.Initialize(GetSafeHwnd());

	return 0;
}
Example #30
0
static PyObject *Evt_SetEventMask(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    EventMask value;
#ifndef SetEventMask
    PyMac_PRECHECK(SetEventMask);
#endif
    if (!PyArg_ParseTuple(_args, "H",
                          &value))
        return NULL;
    SetEventMask(value);
    Py_INCREF(Py_None);
    _res = Py_None;
    return _res;
}