This API change forces all creation of BUrlRequest to be done via
BUrlProtocolRoster::MakeRequest(). This allows the structure of protocol
addons to be altered without breaking ABI for client applications.
Change-Id: I1785c9136c50d19eaa9e57cb9d259ed8d88a5b56
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3080
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Update BTab::DrawTab() to pass the current index, the index of the
selected tab, and the index of the first and last tabs into
BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab().
This allows you to draw tabs differently in your BTab or BControlLook
subclass in many different circumstances.
Modify BControlLook API to add indexes to DrawActiveTab() and
DrawInactiveTab() like so:
void DrawActiveTab(..., int32 index = 0, int32 selected = -1,
int32 first = 0, int32 last = 0);
void DrawInactiveTab(..., int32 index = 0, int32 selected = -1,
int32 first = 0, int32 last = 0);
These extra indexes are not used by HaikuControlLook which relies only
on if the tab is active or inactive to draw.
Add IndexOf(BTab* tab) method to BTabView and document it to get the
index of the current tab in BTab::DrawTab(). Also add a warning in the
BTabView::DrawTab() method not to use the position and full parameters
anymore, use BTabView::IndexOf(), BTabView::Selection(), and
BTabView::TabCount() to get the info you need.
Using a dynamic_cast to a BTabView in BeControlLook to determine if the
view is derived from a BTabView didn't work in the case of WebPositive.
Furthermore, WebPositive does custom tab drawing which needed to be
updated for alternative control look. These index parameters passed from
BTab to BeControlLook allow us to draw the tab like BeOS without relying
on a dynamic_cast to BTabView to get the info.
Reproduce the functionality described above for BTab in WebPositive's
custom tabs. Eliminate no longer needed code in favor of using indexes.
Update WebPositive custom tabs to use BControlLook::DrawTabFrame()
instead of BControlLook::DrawInactiveTab() matching the update made in
BTabView.
In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive
doesn't draw any tab background, so it expects this work to be done for
it.
Eliminate hasFrames variable from WebPositive.
Rename TabSelected(index) to UpdateSelection(index) in WebPositive to
better reflect its purpose.
Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more
selectively. Only draw border if left border is set for top and bottom tabs
or top border is set for left and right tabs. Undo no longer needed frame
manipulation border drawing workaround in HaikuControlLook::DrawTabFrame().
Draw scroll bar triangle without using DrawArrowShape().
Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in
BOutlineListView and menus distinctly from how it draws arrows in scroll
bars. Draw our distinct arrows in DrawSrollBarButtons() instead.
This fixes overflow of time edit up-down arrows in Clock prefs and the
collapse-expand arrow in Deskbar not being vertically centered.
In DrawBorders() only inset if we actually draw the border.
Fix alignment issues with DrawSliderThumb dots for example in
MediaPlayer volume knobs.
Draw using line arrays calling AddLine instead of StrokeLine in
several places.
DrawMenuBar() extends to draw final pixel which eliminates an extra
lines at the end of menu bars.
Truncate button labels better fixing a few issues for example keymap
keyboard layout button labels. Button insets has been updated a bit
to fix drawing issues with buttons missing a border.
Using a dynamic_cast to a BButton to determine if a view is a button
in BeControlLook didn't work in the case of the keymap label. Look for
B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel()
to draw the label inverted on click. Pass the B_FLAT flag from Keymap
keys when drawing using BControlLook so that the label is inverted.
Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Just like post-install scripts which run shortly after a package is
installed, pre-uninstall scripts are run just before a package is
removed. Implements enhancement #13427
* Fix script exit code handling vs script launch errors.
* Bump package and repo file version numbers due to new attribute,
unfortunately makes new .hpkg files not backwards compatible.
* Add pre-uninstall functionality, mostly cloning the post-install
except in a few places.
* Discover that _RunQueuedScripts() is never called, a future TODO:?
* Update package documentation for pre-uninstall scripts, and use of
the boot/post-install directory.
Change-Id: I45596255ce74bc102f6e5b606cbf83e4e4347a17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1504
Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This is probably incomplete. Is locking needed? Should we notify the
next writer (if any) that the port is writable when flushing the output?
Change-Id: I2566e2d036a61af4819894a44f57603179aa27df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2516
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This allows you to pass node_ref's around like you can entry_ref's.
Added node_ref_flatten(), node_ref_unflatten() and node_ref_swap() to
MessageUtils. These are close cousins to entry_ref_flatten(),
entry_ref_unflatten(), and entry_ref_swap() but for node_ref's.
Added B_NODE_REF_TYPE to TypeConstants.h in the Support Kit.
Added B_NODE_REF_TYPE to Debugger and ByteOrder in Support Kit,
B_NODE_REF_TYPE is treated the same as a B_REF_TYPE (entry_ref).
Add documentation for new NodeRef methods and B_NODE_REF_TYPE.
Change-Id: I32c6ed276bf1a7894a835b9fc9de5a882c35883c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3182
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Recalculate line breaks in FrameResized() if word-wrap is on, otherwise
only move the text rect into position. StyledEdit was recalculating line
breaks before on resize (we have to in this mode) and the frame offset
updates for non-wrapping text views are inexpensive. This makes resizing
text view's work like StyledEdit everywhere.
Scroll to cursor when word-wrap setting changes if text view is editable.
If you are viewing a long document changing word-wrap can move the cursor
quite far, so scroll back to it.
Fix _ActualTabWidth() pen location for right and center-aligned text views
so that tabs widths are calculated correctly.
Reset fTextRect horizontal limits to bounds minus insets in
_RecalculateLineBreaks(), then grow fTextRect based on alignment when
wrap is off.
Fixing insets also fixes right and center-aligned BTextViews.
Left-aligned text view's grow right, right-aligned ones grow left,
and center-aligned ones grow out.
Make extra scrolling space for all aligned text views go the other way
from how it did in hrev24130 (and on left-aligned text view's too) so
that half the text is visible when you edit past the end or before the
beginnning of a text view instead of none of it.
Fixes#1651#12608#13796#15189
Do not _RecalculateLineBreaks() if text view bounds are invalid.
In SetText() detect invalid text view bounds and resize the view to the
width and height of the first line. Then recalculate line breaks.
This fixes BAlert text view size issues.
Fixes#16481 (regression from hrev54496.)
Remove useless and heavy computation. There is no point in computing line
breaks for a 10px wide text view and it takes a long time because it needs
a lot of linebreaks. The view eventually gets laid out properly.
Fixes#5582 (which was not locale-related, after all.)
Only apply default insets if text rect is set to bounds. This ensures
that apps that manipulate the text rect can continue to do so without
the default insets interfering while apps that don't can benefit
from the defaults. If you want to set the text rect to bounds and
not use the default insets you must override the default by calling
SetInsets(). This prevent the default insets from being applied once
apps have changed the text rect fixing a bug in Icon-O-Matic where the
text rect insets were being applied incorrectly.
Fixes#16488 (regression from hrev54496.)
Reduce left and right insets inside text views from full label spacing
to half label spacing. Unify padding between BTextControl and BTextView.
Move fLayoutData->UpdateInsets() to private BTextView::_UpdateInsets()
because we need access to BTextView member variables when deciding
whether or not to add the default padding or not.
_UpdateInsets() changes:
* Don't update insets if BTextView::SetInsets() was called.
* Don't add default insets unless fTextRect is set to view Bounds().
* Do not set the right and bottom insets to left and top if negative,
set them to 0 like we do to left and top -- DeskCalc bug otherwise.
Fixes#15688
Other BTextView fixes:
* Replace max_c and min_c with std::max and std::min respectively.
* Remove scrolling from one instance of BTextView::SetText() as it
produced undesired results while editing a scrolled text view.
* Add default insets in _UpdateInsets()
* Fix scrolling when entering and deleting text so that some part of
the text is always visible. Make visible scroll width depend on font
size.
* Allow scrolling to a negative offset in x but not y. This allows you
to scroll the entire contents of right and centered-aligned text views
whose content does not fit in the box.
* Change _Refresh() to take an offset instead of a bool so that you can
scroll to any offset.
* Replace TextLength() with fText->Length() in a couple of places.
TextControl changes:
* Set text rect in BTextControl::DoLayout().
* Remove AlignTextRect() from TextInput.
Fix the following problems in apps:
ScreenSaver: Set text rect in PreviewView::AddPreview().
Tracker: Set "Edit name" text view insets to 2. Tweek text rect position
to be on top of label in icon, mini-icon, and list mode. Add a TODO that
the text rect is a pixel off from the name on some files.
Mail: Remove _AlignTextRect() and FrameResized() from AddressTextControl.
Use default insets on the text view, defaults are fine here.
DeskCalc: Set insets based on font size in ExpressionTextView
SetTextRect() instead of manipulating the text rect.
Remove _CheckTextRect() and related methods from InputTextView.
Icon-O-Matic: Remove _CheckTextRect() and related methods from InputTextView.
WebPositive: Remove _AlignTextRect() and FrameResized() from URLTextView
and call SetInsets().
StyledEdit: Word-wrap and FrameResized() changes ported to BTextView.
Fixes#16476#16480#16488 (regressions from hrev54496.)
Change-Id: Ifeca6077f8815ccd86d5a3880f99556298aaf0fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3152
Reviewed-by: John Scipione <jscipione@gmail.com>
The catalogs are loaded from separate files, so there is no need to have
an app entry_ref to load them, just a MIME type is enough.
The implementation is a bit simplified: only the default catalog format
is allowed (unlike when loading from entry_ref, where extra catalog
formats can be added in add-ons).
Unrelated cleanup: remove unused code to load catalogs from attributes
of an application. We considered this when designing the locale kit, but
using resources or separate files works better.
Use this in Cortex, where some strings are in a static library, so they
don't have an associated executable or library or add-on to identify
them. The code in Cortex is not complete localization, several parts
should use StringForRate, BStringFormat, etc.
Change-Id: I09be22b1f50891250c4497c51e1db8dcee279140
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3172
Reviewed-by: Kacper Kasper <kacperkasper@gmail.com>
The BGradient class is a bit strange as it can store any gradient on its
own, butonly the subclasses allow to set some of the fields.
In the asignment operator, the non-base data (which is in an union) was
not copied over.
More importantly, the missing copy constructor led to the default
implementation being used, and BList (used for the color stops) was
being copied using its default copy constructor, resulting in the two
BGradient (original and copy) poinitng to the same stops data. Heap
corruption resulted whenever one of them was deleted.
Having a working copy ocnstructor fixes this. The alternative is making
the copy constructor private or protected to make sure gradients are not
copied, since normally you'd copy only the subclasses, preserving the
C++ type. However there is nothing enforcing that, and manipulating a
BGradient copied from a subclass works just fine.
Change-Id: I28e733eb8a2970b76ae623eabb75ef8435f508af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3144
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Preserve passed in text rect in fTextRext (unless in layout)
and create an internal version fAlignedTextRect which is used
in place of fTextRect. fAlignedTextRext is aligned to fit the
text rect bounds and grows to fit. fAlignedTextRect always grows
vertically but only grows horizontally if wrap is off.
Left-aligned text view's grow right, right-aligned ones grow left,
and center center aligned ones grow out.
Set fTextRect to bounds in _DoLayout().
Reduce left and right padding inside text views from full label
spacing to half label spacing. Unify padding between BTextControl
and BTextView.
Fixing padding also fixes right and center-aligned BTextViews.
Undo extra scrolling for non-left text views from hrev24130 fixing
a scrolling left and right with mouse bug when it shouldn't.
Replace max_c and min_c with std::max and std::min respectively.
Remove scrolling from one instance of BTextView::SetText as it
produced undesired results while editing a scrolled text view.
Set text rect in BTextControl::DoLayout() and ScreenSaver
PreviewView::AddPreview().
Don't add padding if BTextView::SetInsets() is called. Set insets
to 0 in Tracker "Edit name" setting which prevents default padding
from being added. This is so that when you rename a file in Tracker
the TextView appears on top of the file name text with no padding.
80 char limit fixes.
Fixes#1651#12608#13796#15189#15688
Change-Id: I8c6106effc612f49aff374f29742471628b5df86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3054
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This replaces the use of the hard-coded scroll bar size constants
and instead asks the scrollbars for their preferred sizes directly.
Right now, this is a giant no-op since BScrollBar just returns
the same hard-coded size when asked. The next commit will, however,
change that.
It was always enabled, and disabling it would break ABI.
If we want to make it disable-able, it needs to be a setting,
but I don't really see a reason for that.
* This allows file systems to retrieve the actual error code on a
failure, and report it to the user.
* All affected file systems have been adjusted to the API change.
This is a binary incompatible change.
Change-Id: Id73392aaf9c6cb7d643ff9adcb8bf80f3037874c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2913
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This is required for BMenuBar based toolbars.
Fixes#15785.
Change-Id: I8d108694b481e408e5c56e23a697c8e7829343dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2316
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
For historical reasons, the package kit has an "url" field that is not
actually meant to be used as an URL. Rename it in the API and user
facing output as "identifier" to make it clear what the file is used
for. This change preserves the "url" key in on-disk and online storage
(hpkr files, stored settings, etc) in an attempt to not break anything.
Fix one remaining misuse of the "url" field as an URL in
get_package_dependencies.
Add an unit test showing that BUrl does parse "tab" URIs properly (there
is just a protocol and a path segment).
Change-Id: I339ce526e5798d42d78ae650855d7e988dbb4a1a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2542
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This code comes from an old Be Newsletter and since then the API
received the addition of SetMouseEventMask. In several places the
MouseDownThread was misused: it would spawn a new thread on every mouse
click and not clear the previous one. This could for example lead to
BSpinner skipping values if you clicked it at the right speed.
There are functional changes in BSpinner, before it updated for the
first time 100ms after mouse down, and then as you moved the mouse
around the button, now it activates immediately on first click and then
every 200ms (which may be a bit short). In other places, no functional
changes intended.
Change-Id: Ie600dc68cbb87d1e237633953e5189918bf36575
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2599
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
The code in input_server was pretty much all set for this, but there was
no way to configure the extra buttons. Add them to the mouse view in
Input preferences (up to 5 buttons are handled now)
Define a new B_MOUSE_BUTTON(n) macro to generate the bitmask for a given
button (numbered from 1).
Change-Id: I9091082277937d89b08464ff474e7bbb5db82401
Reviewed-on: https://review.haiku-os.org/c/haiku/+/180
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
BeOS didn't support transparent views. As documented in the Be Book,
SetViewColor(B_TRANSPARENT_COLOR) only effect is to not fill the
invalidated areas with the view color before calling Draw() (it avoids
flickering, especially when combined with B_FULL_UPDATE_ON_RESIZE).
A previous change made B_TRANSPARENT_COLOR actually make the view
transparent (that is, additionally to the above, the underlying view is
drawn before the transparent children), but it creates compatibility
issues.
In order to keep the API compatible with BeOS, the new behavior is now
enabled explicitly using the B_TRANSPARENT_VIEW flag. This also opens
for future developments like allowing a view color with an alpha
channel (not supported yet).
Adjust programs that require transparent views.
Fixes#15744, #15745.
Helps with #15645.
Change-Id: I529574ea23db0a23579521b263bc8d572775e35a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2275
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Scroll bars should look and work identically to before on
HaikuControlLook.
Add DrawScrollBarButton() and DrawScrollBarThumb() and
DrawScrollBarBorder() methods. These methods are used to draw scroll
bars in a generic way so that they can be drawn differently by alternative
control look's (e.g. BeControlLook). Also it gives us back drawing of
scroll bar knobs. However the knob setting is not exposed in the
interface in this commit.
These methods are in addition to the 2 existing DrawScrollBarBackground()
methods that draw the scroll bar background. One draws the area above and
below the thumb and the other is called by the first to actually draw the
area.
The rest of the drawing besides the backgrounds was being done in
BScrollBar before. To draw the scroll bar arrows and thumb we were recyling
other ControlLook methods, while this worked well enough on HaikuControlLook
it wasn't flexible enough for alternative control looks.
DrawScrollBarButton() is used to draw the four scroll buttons and is
typically (so far) used in combination with DrawArrowShape().
DrawScrollBarThumb() draws the scroll bar thumb.
DrawScrollBarBorder() draws a 1px border around the entire scroll bar,
potentially B_KEYBOARD_NAVIGATION_COLOR if focused (although this is
feature not currently used.)
Draw unscrollable scroll bars as if they were disabled including the
buttons with their arrow shapes, background, and thumb.
Add FBC backwords compatibility macros in ControlLook.cpp
Change-Id: I9237c5ce45d17d674785111d51de951e5686306b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/351
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
type is acpi_handle, to be used with the ACPI bus manager
Change-Id: Ibbdd81a21bdd57fc651f7a7238e3676033204857
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2456
Reviewed-by: Rene Gollent <rene@gollent.com>
ACPI_DEVICE_HID_ITEM is now optional, instead of an empty string.
Change-Id: I352ffaaad377659f650a0b8c0d56e40a68b739c3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2420
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
to find a node in the hierarchy.
Change-Id: Iee858f21ce134569bf25fccbef9fe18ea8787e9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2419
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
That's a bad idea. The drag and drop tracking could get confused enough
to crash app_server (possibly because of calling InitiateDrag multiple
times?)
Fixes#14983.
Not used by anything at all, and not included in the build.
Even the BeOS engineer who created it wrote in a Be Newsletter
that he was uncertain how useful it was, which is why BeOS
did not ship it as a kernel add-on...
There is no good reason to put them in a private header.
No functional change (but drivers now have access
to these constants.)
Change-Id: I7ac00a120ab44fbc110bc858dfd87d69d0061135
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2294
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
- Fix USB_hid_page_consumer.h: some values are skipped in the spec so
our defines were off
- Handle the horizontal wheel on my mouse which is declared as a
CON_AC_PAN, but otherwise works just like the vertical wheel
- Input server and interface kit already handle the events properly
(they were available for serial mice already).
Change-Id: Ie0080ebb27e9478bcfe9f9dc5fd2a936ae05a848
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2201
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
In a menu, we use the right side both for submenu arrows and shortcuts.
As a result, when an entry has both a shortcut and a submenu, its
shortcut is not aligned with others, and this does not look so nice.
The spacing for the arrow appears only if there is a submenu in any of
the items in the parent menu.
Change-Id: If91fdcdad36abb0141fb05d1f59141f89540c1db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/355
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
This is required for building shared libraries with hidden by default symbol
visiblility such as mesa.
Change-Id: I7150629aaea61d7c9b6e641d32913c5cc7c96543
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2159
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>