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); } }
// --------------------------------------------------------------------- //! Called when it starts dragging. // --------------------------------------------------------------------- void BeSkinView::BeginMouseCapture() { if (0 == mouseCaptureNestCount) SetEventMask(EventMask() | B_POINTER_EVENTS); mouseCaptureNestCount++; }
// --------------------------------------------------------------------- //! Called when it ends dragging. // --------------------------------------------------------------------- void BeSkinView::EndMouseCapture() { if (mouseCaptureNestCount > 0) { mouseCaptureNestCount--; if (0 == mouseCaptureNestCount) { SetEventMask(EventMask() & ~B_POINTER_EVENTS); } } }
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); }
PerfMeasurement::PerfMeasurement(PerfMeasurement::EventMask toMeasure) : impl(js_new<Impl>()), eventsMeasured(impl ? static_cast<Impl*>(impl)->init(toMeasure) : EventMask(0)), cpu_cycles(initCtr(CPU_CYCLES)), instructions(initCtr(INSTRUCTIONS)), cache_references(initCtr(CACHE_REFERENCES)), cache_misses(initCtr(CACHE_MISSES)), branch_instructions(initCtr(BRANCH_INSTRUCTIONS)), branch_misses(initCtr(BRANCH_MISSES)), bus_cycles(initCtr(BUS_CYCLES)), page_faults(initCtr(PAGE_FAULTS)), major_page_faults(initCtr(MAJOR_PAGE_FAULTS)), context_switches(initCtr(CONTEXT_SWITCHES)), cpu_migrations(initCtr(CPU_MIGRATIONS)) {}
void TBarView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) { if (Window() == NULL || EventMask() == 0) return; // Auto-Raise where = ConvertToScreen(where); BScreen screen(Window()); BRect frame = screen.Frame(); if (where.x == frame.left || where.x == frame.right || where.y == frame.top || where.y == frame.bottom) { // cursor is on screen edge if (Window()->Frame().Contains(where)) Window()->Activate(); } }