Updated gfx kerneldrivers for clonable framebuffers.

This commit is contained in:
RudolfC
2020-05-05 21:42:39 +00:00
5 changed files with 106 additions and 102 deletions
@@ -646,10 +646,19 @@ usb_midi_write(driver_cookie* cookie, off_t position,
DPRINTF_DEBUG((MY_ID "MIDI write (%" B_PRIuSIZE " bytes at %" B_PRIdOFF DPRINTF_DEBUG((MY_ID "MIDI write (%" B_PRIuSIZE " bytes at %" B_PRIdOFF
")\n", *num_bytes, position)); ")\n", *num_bytes, position));
if (*num_bytes > 3 && midicode != 0xF0) { // Make sure we always write exactly one MIDI event at a time.
DPRINTF_ERR((MY_ID "Non-SysEx packet of %ld bytes" // SysEx can be of arbitrary sizes, for all others, we check that the
" -- too big to handle\n", *num_bytes)); // complete event was passed in and do not use more than that.
return B_ERROR; // TODO add a loop to allow writing multiple events in a single write()
// call if desired.
if (midicode != 0xF0) {
if ((int)*num_bytes < CINbytes[cin]) {
DPRINTF_ERR((MY_ID "Expected %d bytes for MIDI command %" B_PRIu8
" but got only %" B_PRIuSIZE ".\n", CINbytes[cin], cin,
*num_bytes));
return B_BAD_DATA;
}
*num_bytes = CINbytes[cin];
} }
size_t bytes_left = *num_bytes; size_t bytes_left = *num_bytes;
+1 -1
View File
@@ -1109,7 +1109,7 @@ bool
accept_first_click() accept_first_click()
{ {
// Gets the accept first click status // Gets the accept first click status
bool acceptFirstClick = false; bool acceptFirstClick = true;
BPrivate::AppServerLink link; BPrivate::AppServerLink link;
link.StartMessage(AS_GET_ACCEPT_FIRST_CLICK); link.StartMessage(AS_GET_ACCEPT_FIRST_CLICK);
+30 -14
View File
@@ -411,20 +411,26 @@ BScrollBar::Draw(BRect updateRect)
rect.left + rect.Height(), rect.bottom); rect.left + rect.Height(), rect.bottom);
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect, be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
base, flags, BControlLook::B_LEFT_ARROW, fOrientation, base, flags | (fPrivateData->fButtonDown == ARROW1
? BControlLook::B_ACTIVATED : 0),
BControlLook::B_LEFT_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW1); fPrivateData->fButtonDown == ARROW1);
if (doubleArrows) { if (doubleArrows) {
buttonFrame.OffsetBy(rect.Height() + 1, 0.0f); buttonFrame.OffsetBy(rect.Height() + 1, 0.0f);
be_control_look->DrawScrollBarButton(this, buttonFrame, be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
updateRect, base, flags, BControlLook::B_RIGHT_ARROW, base, flags | (fPrivateData->fButtonDown == ARROW2
fOrientation, fPrivateData->fButtonDown == ARROW2); ? BControlLook::B_ACTIVATED : 0),
BControlLook::B_RIGHT_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW2);
buttonFrame.OffsetTo(rect.right - ((rect.Height() * 2) + 1), buttonFrame.OffsetTo(rect.right - ((rect.Height() * 2) + 1),
rect.top); rect.top);
be_control_look->DrawScrollBarButton(this, buttonFrame, be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
updateRect, base, flags, BControlLook::B_LEFT_ARROW, base, flags | (fPrivateData->fButtonDown == ARROW3
fOrientation, fPrivateData->fButtonDown == ARROW3); ? BControlLook::B_ACTIVATED : 0),
BControlLook::B_LEFT_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW3);
thumbBG.left += rect.Height() * 2 + 2; thumbBG.left += rect.Height() * 2 + 2;
thumbBG.right -= rect.Height() * 2 + 2; thumbBG.right -= rect.Height() * 2 + 2;
@@ -435,27 +441,35 @@ BScrollBar::Draw(BRect updateRect)
buttonFrame.OffsetTo(rect.right - rect.Height(), rect.top); buttonFrame.OffsetTo(rect.right - rect.Height(), rect.top);
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect, be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
base, flags, BControlLook::B_RIGHT_ARROW, fOrientation, base, flags | (fPrivateData->fButtonDown == ARROW4
? BControlLook::B_ACTIVATED : 0),
BControlLook::B_RIGHT_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW4); fPrivateData->fButtonDown == ARROW4);
} else { } else {
BRect buttonFrame(rect.left, rect.top, rect.right, BRect buttonFrame(rect.left, rect.top, rect.right,
rect.top + rect.Width()); rect.top + rect.Width());
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect, be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
base, flags, BControlLook::B_UP_ARROW, fOrientation, base, flags | (fPrivateData->fButtonDown == ARROW1
? BControlLook::B_ACTIVATED : 0),
BControlLook::B_UP_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW1); fPrivateData->fButtonDown == ARROW1);
if (doubleArrows) { if (doubleArrows) {
buttonFrame.OffsetBy(0, rect.Width() + 1); buttonFrame.OffsetBy(0, rect.Width() + 1);
be_control_look->DrawScrollBarButton(this, buttonFrame, be_control_look->DrawScrollBarButton(this, buttonFrame,
updateRect, base, flags, BControlLook::B_DOWN_ARROW, updateRect, base, flags | (fPrivateData->fButtonDown == ARROW2
fOrientation, fPrivateData->fButtonDown == ARROW2); ? BControlLook::B_ACTIVATED : 0),
BControlLook::B_DOWN_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW2);
buttonFrame.OffsetTo(rect.left, rect.bottom buttonFrame.OffsetTo(rect.left, rect.bottom
- ((rect.Width() * 2) + 1)); - ((rect.Width() * 2) + 1));
be_control_look->DrawScrollBarButton(this, buttonFrame, be_control_look->DrawScrollBarButton(this, buttonFrame,
updateRect, base, flags, BControlLook::B_UP_ARROW, updateRect, base, flags | (fPrivateData->fButtonDown == ARROW3
fOrientation, fPrivateData->fButtonDown == ARROW3); ? BControlLook::B_ACTIVATED : 0),
BControlLook::B_UP_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW3);
thumbBG.top += rect.Width() * 2 + 2; thumbBG.top += rect.Width() * 2 + 2;
thumbBG.bottom -= rect.Width() * 2 + 2; thumbBG.bottom -= rect.Width() * 2 + 2;
@@ -466,7 +480,9 @@ BScrollBar::Draw(BRect updateRect)
buttonFrame.OffsetTo(rect.left, rect.bottom - rect.Width()); buttonFrame.OffsetTo(rect.left, rect.bottom - rect.Width());
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect, be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
base, flags, BControlLook::B_DOWN_ARROW, fOrientation, base, flags | (fPrivateData->fButtonDown == ARROW4
? BControlLook::B_ACTIVATED : 0),
BControlLook::B_DOWN_ARROW, fOrientation,
fPrivateData->fButtonDown == ARROW4); fPrivateData->fButtonDown == ARROW4);
} }
+61 -82
View File
@@ -48,99 +48,78 @@ FakeScrollBar::~FakeScrollBar(void)
void void
FakeScrollBar::Draw(BRect updateRect) FakeScrollBar::Draw(BRect updateRect)
{ {
BRect bounds = Bounds(); rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR); uint32 flags = BControlLook::B_PARTIALLY_ACTIVATED;
if (IsFocus()) { if (Value() == B_CONTROL_ON)
// draw the focus indicator SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR)); else
StrokeRect(bounds); SetHighColor(base);
bounds.InsetBy(1.0, 1.0);
// Draw the selected border (1px) BRect rect(Bounds());
if (Value() == B_CONTROL_ON)
SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
else
SetHighColor(normal);
StrokeRect(bounds); // draw the selected border (2px)
bounds.InsetBy(1.0, 1.0); StrokeRect(rect);
} else { rect.InsetBy(1, 1);
// Draw the selected border (2px) StrokeRect(rect);
if (Value() == B_CONTROL_ON) rect.InsetBy(1, 1);
SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
else
SetHighColor(normal);
StrokeRect(bounds); // draw a 1px gap
bounds.InsetBy(1.0, 1.0); SetHighColor(base);
StrokeRect(bounds); StrokeRect(rect);
bounds.InsetBy(1.0, 1.0); rect.InsetBy(1, 1);
// draw a 1px border around the entire scroll bar
be_control_look->DrawScrollBarBorder(this, rect, updateRect, base, flags,
B_HORIZONTAL);
// inset past border
rect.InsetBy(1, 1);
// draw arrow buttons
if (fDrawArrows) {
BRect buttonFrame(rect.left, rect.top, rect.left + rect.Height(),
rect.bottom);
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
base, flags, BControlLook::B_LEFT_ARROW, B_HORIZONTAL);
if (fDoubleArrows) {
buttonFrame.OffsetBy(rect.Height() + 1, 0.0f);
be_control_look->DrawScrollBarButton(this, buttonFrame,
updateRect, base, flags, BControlLook::B_RIGHT_ARROW,
B_HORIZONTAL);
buttonFrame.OffsetTo(rect.right - ((rect.Height() * 2) + 1),
rect.top);
be_control_look->DrawScrollBarButton(this, buttonFrame,
updateRect, base, flags, BControlLook::B_LEFT_ARROW,
B_HORIZONTAL);
}
buttonFrame.OffsetTo(rect.right - rect.Height(), rect.top);
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
base, flags, BControlLook::B_RIGHT_ARROW, B_HORIZONTAL);
} }
// draw a gap (1px) // inset rect to make room for arrows
SetHighColor(normal);
StrokeRect(bounds);
bounds.InsetBy(1.0, 1.0);
// draw a border around control (1px)
SetHighColor(tint_color(normal, B_DARKEN_1_TINT));
StrokeRect(bounds);
bounds.InsetBy(1.0, 1.0);
BRect thumbBG = bounds;
BRect bgRect = bounds;
if (fDrawArrows) { if (fDrawArrows) {
// draw arrows if (fDoubleArrows)
SetDrawingMode(B_OP_OVER); rect.InsetBy((rect.Height() + 1) * 2, 0.0f);
else
rect.InsetBy(rect.Height() + 1, 0.0f);
}
BRect buttonFrame(bounds.left, bounds.top, // draw background and thumb
bounds.left + bounds.Height(), bounds.bottom); float less = floorf(rect.Width() / 3);
BRect thumbRect(rect.left + less, rect.top, rect.right - less,
_DrawArrowButton(ARROW_LEFT, buttonFrame, updateRect); rect.bottom);
BRect leftOfThumb(rect.left, thumbRect.top, thumbRect.left - 1,
if (fDoubleArrows) { thumbRect.bottom);
buttonFrame.OffsetBy(bounds.Height() + 1, 0.0); BRect rightOfThumb(thumbRect.right + 1, thumbRect.top, rect.right,
_DrawArrowButton(ARROW_RIGHT, buttonFrame, thumbRect.bottom);
updateRect);
buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1),
bounds.top);
_DrawArrowButton(ARROW_LEFT, buttonFrame,
updateRect);
thumbBG.left += bounds.Height() * 2 + 2;
thumbBG.right -= bounds.Height() * 2 + 2;
} else {
thumbBG.left += bounds.Height() + 1;
thumbBG.right -= bounds.Height() + 1;
}
buttonFrame.OffsetTo(bounds.right - bounds.Height(), bounds.top);
_DrawArrowButton(ARROW_RIGHT, buttonFrame, updateRect);
SetDrawingMode(B_OP_COPY);
bgRect = bounds.InsetByCopy(48, 0);
} else
bgRect = bounds.InsetByCopy(16, 0);
// fill background besides the thumb
BRect leftOfThumb(thumbBG.left, thumbBG.top, bgRect.left - 1,
thumbBG.bottom);
BRect rightOfThumb(bgRect.right + 1, thumbBG.top, thumbBG.right,
thumbBG.bottom);
be_control_look->DrawScrollBarBackground(this, leftOfThumb, be_control_look->DrawScrollBarBackground(this, leftOfThumb,
rightOfThumb, updateRect, normal, 0, B_HORIZONTAL); rightOfThumb, updateRect, base, flags, B_HORIZONTAL);
be_control_look->DrawScrollBarThumb(this, thumbRect, updateRect,
// Draw scroll thumb ui_color(B_SCROLL_BAR_THUMB_COLOR), flags, B_HORIZONTAL, fKnobStyle);
// fill the clickable surface of the thumb
be_control_look->DrawButtonBackground(this, bgRect, updateRect,
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
} }
+1 -1
View File
@@ -40,7 +40,7 @@ static const bigtime_t kDefaultClickSpeed = 500000;
static const int32 kDefaultMouseSpeed = 65536; static const int32 kDefaultMouseSpeed = 65536;
static const int32 kDefaultMouseType = 3; // 3 button mouse static const int32 kDefaultMouseType = 3; // 3 button mouse
static const int32 kDefaultAccelerationFactor = 65536; static const int32 kDefaultAccelerationFactor = 65536;
static const bool kDefaultAcceptFirstClick = false; static const bool kDefaultAcceptFirstClick = true;
InputMouse::InputMouse(BInputDevice* dev) InputMouse::InputMouse(BInputDevice* dev)