Commit Graph

9459 Commits

Author SHA1 Message Date
Leorize
3e27f8d5a7 libbnetservices: BUrlResult is no longer a BArchivable
The switch to make BUrlResult serializable was debuted in
f9e1854f19 with the rationale is that
BHttpRequest auto-redirection might cause the headers to become
obsolete by the time a client process the BMessage received from
BUrlProtocolDispatchingListener.

With the change to BHttpRequest to not notify listeners when
auto-redirection is enabled, this is no longer the case and the
serialization code can go away now. This simplifies BUrlResult and its
subclasses, and gain us some performance for clients using
BUrlProtocolDispatchingListener as the result object no longer has to be
serialized.

This also change the ABI of BUrlProtocolListener::HeadersReceived to no
longer passing a BUrlResult.

Additionally, BUrlResult and BHttpResult now express the size of the content
as an off_t, thus allowing results larger than 4 GB.

Change-Id: I9dd29a8b26fdd9aa8e5bbad8d1728084f136312d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3082
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-02-28 20:39:31 +00:00
Leorize
8e3c76b3d2 HttpRequest: Don't trigger listener on auto redirect
When the user enable auto-redirection, what they meant is that they do
not want to handle redirections, thus we should take total control of this
step and hide it from the user. In fact, a majority of in-tree users
write code to disable their listener when a redirection happen.

This should also allow us to simplify BUrlResult, which has been turned
into a BArchivable for the sole reason of "preserving" headers when
auto redirect is enabled when used with BUrlDispatchingListener, which
has been shown to have little (if any) practical usage.

Change-Id: I9b10b81de0a13edbaec25f6b48ed7a4335ea691a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3081
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-02-28 20:39:31 +00:00
Adrien Destugues
6e1e87a3c3 Locale Kit: do not unload catalog add-ons
Follow-up to #16670.

I have previously changed the locale kit to load all add-ons once at
start, but did not notice that it would unload them later on. This can
also create race conditions if the locale kit is used from inside
load_add_on (as is the case in translation kit add-ons for example).

Should fix the remaining problems in #16670

Change-Id: I0e22f8e146abe4fc85d8357ebe178db948fec1cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3734
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-02-12 07:35:05 +00:00
X512
779ab335dd use .IsSet() instead if .Get() != NULL
Change-Id: Ia2b7a719fd398e78cc3b11d4f7b02cb81179f65f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3488
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-02-02 15:17:54 +00:00
Jérôme Duval
0ce3a760d3 libnetwork: handle EINTR on select() and poll()
Change-Id: I4e3562bd2564dd0c61142d0b467c81abd393373a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3726
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2021-02-01 19:35:02 +00:00
Adrien Destugues
e03da2bd84 Locale Kit: Fix available language enumeration
Regression introduced in hrev54910.
The list of available languages in FirstBootPrompt would be empty.
2021-01-30 17:43:32 +01:00
Adrien Destugues
6f3a5c9ab0 Debugger: add AVX support
- Unify storage of "FPU" registers between debugger and signal handler
  to use xsave format on both sides
- Handle YMM registers in Debugger (they are the same as XMM, but wider)

Tested:
- The system still boots with and without AVX
- The hello_avx test program can be debugged and the full value of YMM is visible

This changes the API of vregs in signal.h but not the ABI (structure are
declared differently but memory layout is the same). This changes the
API and ABI of arch_debugger.h for x86_64, but I don't think anything
outside Haiku uses it (did we ever have a 64bit compatible gdb?)

Change-Id: If93680ffa0339c19bab517876b4e029f5d66b240
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3038
Reviewed-by: Rene Gollent <rene@gollent.com>
2021-01-29 13:29:10 +00:00
Niels Sascha Reedijk
e95af9e0ef libnetservices.a: final cleanup after progress size change to off_t
Final fallout of the hrev54936 change

Change-Id: Id4836359f49dffbef76916db7fb7b51dd1e490d8
2021-01-28 11:08:10 +00:00
Niels Sascha Reedijk
e1467b2bf1 libnetservices.a: properly handle the size change to off_t on 32 bit platforms.
This is a missed use of the updated headers in hrev54926

Change-Id: I9be83d29aadec20549bd4cc0d11238a40d8978f4
2021-01-28 10:30:02 +00:00
Niels Sascha Reedijk
1a0b4125b6 libpackage.so: change UrlProtocolListener size types to off_t
Missed this use after changing the definition in hrev54926

Change-Id: I046560ec73dfb3ed6284513a34228b8343c5cf40
2021-01-28 10:08:40 +00:00
Niels Sascha Reedijk
8579c7faf2 Package Kit: switch to libnetservices.a
Switch to the experimental services API as the copy in libbnetapi.so is
deprecated.

Change-Id: Ia0742038937d078c6a59ae13180a00a4c4eeb177
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3671
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
2a7090df71 libnetservices.a: move BGeoLocation from libshared.a
The BGeolocation class uses the network interface in libnetservices.a, so it
is moved here for now.

This will break any out of tree projects that depend on it, but it is a source
incompatible change only.

Change-Id: I6f5b1332eb87ad37dd33fbe09fdb11b16f7f26e4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3670
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
ce64ffdb90 libnetservices.a: Put the experimental API into BPrivate::Network namespace
In order to prevent classes between libnetapi.so with the legacy API and
applications using the libnetservices.a library, the latter will have the
classes in a distinct namespace.

In the implementation, both libbnetapi.so and libnetservices.a will use the
same header and source files. If LIBNETAPI_DEPRECATED is defined during build,
the headers and source will have binary compatible behavior. Otherwise, the
classes and other objects will be put in the HaikuExt namespace.

In order to build the libbnetapi.so and libnetservices.a with the proper
build configuration, there is a stub `src/kits/net/libnetapi_deprecated` folder
that applies the special configuration to the source files.

Currently HaikuDepot, Webpositive, libshared.a and the http_streamer add on
use the compatible API in libbnetapi.so.

Change-Id: Ic73e9f271ef75749adda46f6f72e9a0b2851b461
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3667
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
1b133b90fd libnetservices.a: create new static library for the network services
These will be added to the _devel packages so that other applications can link
to them.

Change-Id: If3fd231869823b42d6d896c6c9eb7a95c5fe715d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3666
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
603e0bdf62 libnetapi.so: make headers of deprecated classes private
These classes have been moved to the public API too soon, and they need some
more time to mature before they can be declared stable.

Change-Id: I9c52a8e6cc103922abde7a6b911fe0c3e6bf5700
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3665
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
35d8d4d113 libnetapi.so: move deprecated classes out into a libnetservices directory
These classes have been moved to the public API too soon, and they need some
more time to mature before they can be declared stable.

In this first step the classes that are involved, are moved to a separate
folder. They will still be linked to libnetapi.so, so that binaries that
depend on them currently will not break.

Change-Id: I6c16f17573d819314a27936f065ebe675846f763
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3664
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Adrien Destugues
dd3b46ac1e Package Kit: smarter download resume
Pick the most advanced partial download to resume from if there are
multiple ones.

Fixes the remaining part of #16744.

Change-Id: I0ed7daf42e0346632918552e97d660b4946405cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3672
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2021-01-26 20:25:52 +00:00
X512
08e58a41e5 TextView: Select dropped text if focused
This is convenient and used in most text editors.

Change-Id: Ia39b9e6f16cc381a62e10b248033729179a0996c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2110
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2021-01-25 08:13:41 +00:00
Adrien Destugues
4cf4daf212 Locale Kit: move catalog add-ons loading to early initialization
The catalog loading has been done lazily since forever (this code was
imported from OpenTracker). It results in a race condition as explained
in #16670.

Moving the catalog loading earlier in the locale loading process avoids
this problem, since load_add_on is called before the locale roster lock
is used.

This should fix #16670.

Change-Id: If07054077f7dde41cb342a43af2abe8422239b05
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3661
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-23 12:21:15 +00:00
Máximo Castañeda
67eeb4db48 MediaExtractor: go back to 3MB min cache size
Should allow us to at least play the same files we could play before.

Fixes #16738, though not its cause

Change-Id: I2d23011696b730a891c802e8c2bfc23afe0041cf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3628
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-19 20:29:39 +00:00
Stephan Aßmus
bc1e082b56 BHttpRequest: Treat incomplete downloads as error
When BSocket::Read() returns 0, it was treated as
a finished transfer. This is OK when we don't know
the content length, but when we do, there is no reason
not to bubble up the error. Return B_IO_ERROR in this
case.

Change-Id: I68801dbbb85bcfd2e7aa68fd6a9ded6304e82b19
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3621
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-19 17:05:40 +00:00
Stephan Aßmus
7e677f6465 Package Kit: Delete downloads failing the checksum check
Change-Id: I3a7a914ea88e7b7b5bcc79160f46a9b4fcbba01b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3619
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-18 20:27:12 +00:00
Stephan Aßmus
60c165a53c BSecureSocket: Treat SSL-zero-return as B_IO_ERROR
Somehow B_CANCELED doesn't seem to convey the correct
meaning. Using B_IO_ERROR will also fit to the recent
changes in the Package Kit and will trigger a re-try of
package downloads.

Change-Id: I58c4d4faa705e6519e0ff9ec7c4654a6151e5486
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3635
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-16 16:32:32 +00:00
X512
111df1707b Tracker: add more string types to attributes view
Used in MIME database.

Change-Id: Ieaff506ea8be0fe7d57bfe76fd63439ef4952116
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3625
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-14 18:31:10 +00:00
Máximo Castañeda
7f9c675629 MediaExtractor: access chunk cache only when we have it
Change-Id: I533bb2e25b0756acaaa227cdd06c4067d4120066
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3622
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-10 22:07:16 +00:00
Adrien Destugues
7b661b559e BSecureSocket: fix read error handling
The current documentation
(https://www.openssl.org/docs/man1.1.1/man3/SSL_read.html) says that
SSL_read returning 0 should be handled as an error. So, let's do that.

Change-Id: I6781826ea700b6e597fd2d444fd96a1a5270c6cf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3620
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2021-01-10 17:34:44 +00:00
Adrien Destugues
61282f9574 Tracker: fix invisible selection text in disabled windows
Regression introduced in hrev54742 which used DeskTextColor() on a
non-desktop view. The view color isn't set anywhere in that case and
does not match the background color, which led to drawing white text on
a white background.

Moreover, a second bug was stacked on that: the selection is drawn in
"reverse video" (using the document color for the text and document text
color for the background) only for active windows. For inactive ones, it
is drawn normally, and then a middle-grey rectangle is alpha blended on
top. Add a comment to clarify that and reintroduce the ckeck that had
been removed.

Also replace the hardcoded black for the selection background, so it
will be more easily visible for people using dark mode.

Fixes #16627.
2021-01-10 13:49:17 +01:00
Adrien Destugues
e3927d6ad4 Haiku control look: bring back the tab seams
They were accidentally removed in hrev54634 in an attempt to clean up
the code.

Reintroduce the old logic with some cleanup and improvements:
- There was a mixup of "tab side" vs "border". The constant values for
  the two are the same, so it still worked as designed, but it made the
  code harder to follow since it deals with both borders and tab sides.
- Define an isVertical boolean to decide if the tab view is vertical,
  avoiding repeated tests for specific tabview sides.

Fixes #16640.
2021-01-10 13:01:05 +01:00
Stephan Aßmus
8c812f2d63 BHttpRequest: Fix the cast and therefor GCC2 build
Change-Id: Ia0729a20d143721d395d5d50719e87b99b76bb05
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3614
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2021-01-09 15:56:08 +00:00
Adrien Destugues
f15516ff92 Package Kit: re-use downloads from unfinished transactions
There are three parts to this change:
- In FetchFileJob, if the request fails with a timeout or IO error
  (probably because of unstable connection) attempt to resume the
  download with a range request. No limit on number of retries
  currently, maybe we should add one.
- In PackageManager, before downloading a file, look around in other
  transaction directories in case it's already there. Partial and
  complete downloads are differentiated by an attribute which the
  fetch file job maintains. For complete downloads, no fetch job is
  scheduled, for partial downloads, the fetch job will request the
  remainder of the file.
- In BHttpRequest, the implementation of SetRangeStart() and
  SetRangeEnd() have been added, along with some refactoring to
  handle listener notifications consistently. This also fixed a
  bug where the final notification for download progress was not
  emitted for compressed data.

Fixes #12414.

Change-Id: I3e285741ed0e5651594a7c2e1c7170644a9d297d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3404
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-09 15:20:09 +00:00
Adrien Destugues
d753645e3f MediaExtractor: fix cache size computation for audio
Untested. If audio is not decoding well, try increasing the constant.

Change-Id: I151764e6bb3e69088904d33bfeb683bf0569bd23
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3605
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-08 14:28:41 +00:00
Alexander von Gluck IV
6b49a15b64 media_kit: Dynamic allocation of ChunkCache based on media
* The "default" of 3MiB wasn't enough for modern larger media
  formats, resulting in inability to play 4k video no matter
  how much horse power you threw at Haiku. (4k is ~8MiB)
* This dynamically calculates the ChunkCache based on the
  video framesize * 2.
* 4k video now plays smoothly on my Ryzen 1800x.

Change-Id: I65bf6bd6fa60ac3196ea70eeeb5e655d43c10bcd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3598
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-03 20:51:37 +00:00
Máximo Castañeda
2e68fbd207 Fix wrap for AUDIO_INT
Floats don't have enough precision for all 32 bit integers. In
particular, near INT32_MAX their value is INT32_MAX + 1, which, when
converted back to int becomes INT32_MIN.

Change-Id: Ief3c1177b4f69baac13df5bac977882fea95ae01
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3511
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-30 13:35:14 +00:00
Máximo Castañeda
80a920f65d BSoundPlayer: check for NULL node
Fixes #16683

Change-Id: I81c252b6eeaeb35cc5f33a796a7242c0965c3f27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3546
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-23 19:57:32 +00:00
Alexander von Gluck IV
31fd7ccc19 kits/bluetooth: Improve knowledge of BT versions
* Drop spaces as well, any text alignment needs to
  happen in UI

Change-Id: I2258330baa51e82095e3f7432e60747abb639aa3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3538
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-21 14:57:10 +00:00
Máximo Castañeda
42b9734805 Set normal mouse mode on set_focus_follows_mouse(false)
Change-Id: Iae4300d7da5ada391c2d2dccff2b7de7f1b38245
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3509
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-21 14:29:15 +00:00
Adrien Destugues
015d6c1306 BMenuField: use anonymous namespace for internal class.
As suggested by korli, this is indeed a better way to hide internal
classes and make them completely unreachable from outside the cpp file
they are defined in.
2020-12-19 10:54:06 +01:00
Adrien Destugues
8a72ba1b54 Tracker: improve algorithm to decide desktop text color
Fixes #16673
2020-12-19 10:17:55 +01:00
Adrien Destugues
f7a0ebd7a5 BMenuField: Fix private ABI leakage
Problem introduced in hrev46195. The MouseDownFilter class may be
declared deep in the middle of a cpp file, yet without precautions, it
will end up being part of the ABI.

WonderBrush has a class with the same name, and on 64bit Haiku, a mixup
of the two would happen, leading to a crash because they don't have the
same size.

Move the class into BPrivate to avoid this.

Change-Id: I60b608edf3188816281332c972c654e3c57740b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3536
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-12-17 20:10:59 +00:00
Alexander von Gluck IV
638910607a libnetwork/BHttpRequest: Fix type mis-alignment breaking gcc2
Change-Id: I927d54758efec30bb35cd041ac5fc91a69299099
2020-12-17 08:39:17 -06:00
Alexander von Gluck IV
d36f7ca577 libnetwork/BHttpRequest: Actually report form file upload progress
* Solves #16671

Change-Id: If112d6e2319eb076968c4caf8fcd3b8746ed324f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3515
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2020-12-17 14:13:09 +00:00
X512
cdccd323b5 use common AutoDeleter types
Change-Id: I115e14b76f3ff049c5f7d9471efd3619a0038fcf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3483
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-12-13 19:14:13 +00:00
Murai Takashi
efc042ff48 Window: Fix dead assignment
Fix value stored to 'maxWidth' or 'maxHeight' is never read
when maxWidth > fMaxWidth or maxHeight > fMaxHeight.
Pointed out by Clang Static Analyzer.

Change-Id: I2bd0b8712d47e64298c0f915f24f7f1c87f4362e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3474
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-10 11:40:20 +00:00
X512
36aafa560b fix build after CObjectDeleter interface change
Change-Id: I76e217abcd13c22c4d68170e07333cdde4d7a891
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3461
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-10 11:39:49 +00:00
Adrien Destugues
369abf3be4 Have a minimum size for scrollbars
With small font sizes, the scrollbars don't need to get smaller than 14
pixels. So, don't allow the scaling to go below 1.
2020-12-09 21:57:31 +01:00
Adrien Destugues
5d1042057b Add Noto Sans Symbols2 to font fallbacks
Also use the correct symbol for the return key (we were using another
similar arrow because this one was not available in DejaVu Sans).

Fixes #14034.

Note that build/jam/repositories/HaikuPorts ships an old version of the
Noto package that does not include the Symbols2 font. It should be
updated. Adding this to the pile of lagging behind packages, alongside
icu, mawk/gawk, and tnftp. Can anyone take care of it?
2020-12-09 20:00:26 +01:00
Jérôme Duval
65b3fe452a GameKit: give up default template parameter for gcc2 2020-12-08 15:46:55 +01:00
Murai Takashi
2db8ba2c8d Menu: Fix dead store
Fix value stored to 'flags' is never read.
Pointed out by Clang Static Analyzer.

Change-Id: Ia154fbdd4dd5fb10716cf9079625ca65e2f58122
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3472
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-08 13:46:51 +00:00
Jérôme Duval
6336b86ab8 GameKit: gcc2 build fix 2020-12-08 14:39:56 +01:00
Máximo Castañeda
fb6ee7844d GameSoundBuffer: avoid buffer copy
Change-Id: Ibffe80ebe5e8205e853e09b6ebb9ba65b53d83e7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3475
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-08 12:33:22 +00:00
Máximo Castañeda
cfe72209cf U8 sound format
U8 sound has a nonzero value as its zero amplitude, so it needs to be
special-cased when mixing, applying gains and other transformations.

Change-Id: I5ad96b5f39d454bffad2449ac9f27b2ae61e2ccd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3470
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-08 12:33:22 +00:00
Máximo Castañeda
8e9d64f0d6 FileGameSound: fix stuck in pause when ramped
Change-Id: I346d7b93fa8507451ee46856ad6618acd6e2d609
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3469
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-08 04:32:56 +00:00
Máximo Castañeda
15de111dcf FileGameSound: fix buffer advance accounting
Change-Id: I15bb2b1e703cad955544a1151adc6a1277b077a8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3467
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-08 04:32:56 +00:00
Máximo Castañeda
8eafd6cd04 GameKit: use more than 1 sec precision ramping
Change-Id: I015f116239fad5dd48f7f4509db503dc8f60c0d0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3468
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-12-06 18:17:55 +00:00
Augustin Cavalier
10bc5b6e2f Tracker: Increase the readability threshhold to 50%.
nephele is working a more comprehensive fix to this code, but for now,
this seems to be sufficient for the time being.
2020-12-05 15:23:14 -05:00
John Scipione
30ecf636e0 Tracker: Scroll text to beginning on edit name
... so that the full file name is shown.

Center the file name in the edit box a bit better, the edit box is still
off compared to the non-editable file name by a pixel sometimes.

Use be_plain_font instead of getting the font from the PoseView since
the PoseView font is set to be_plain_font.

Fixes #16476

Change-Id: Ibda9341593163cdde898a83c98bf5ccea37126be
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3399
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-02 17:58:47 +00:00
Máximo Castañeda
64fc5a66b1 DefaultMediaTheme: fix Slider scale
Values are using a scale of 1000, but limits are set 0..100. Very
visible in media preferencies when using balance controls for stereo
connections in the mixer: the control is shown full right at first and
the moment you touch it and the gain is updated, you only get sound from
the left channel.

Probably the root cause of #15836 and #16070.

Change-Id: I31d3b6b11a57ca99a1cc8373d9fb003f21b192b3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3445
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-30 20:06:16 +00:00
Pascal Abresch
7377c39855 Tracker: make desktop color selection try user color first
Change-Id: I47392bdafe8ecf1996886fd0a8324a114f4524fd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3407
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-11-29 16:23:59 +00:00
Pascal Abresch
7866835b41 Tracker: remove desktop check for text colors in poseview
Change-Id: I4db3cd5525242314bd7177dcdd25cd8ec0aa1f7f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3406
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-11-29 16:23:59 +00:00
Murai Takashi
0404495f3b tracker: Fix PVS V595
Add NULL check for 'ContainerWindow()', since it might return NULL.

Change-Id: I0a9e7243c6d23be7559331dcd72e0675eb44809e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2161
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-27 07:19:56 +00:00
Pascal Abresch
ff21b4c370 HaikuControlLook: don't modify menu color before applying it
Change-Id: I31838d4c17d4616c2c166197596a93bf51785677
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3410
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-26 07:35:33 +00:00
John Scipione
1897036191 BTextView: ensure text rect width and height is > 0
Helps wth #16476 #16568

Change-Id: Idc8d399cf69776d26e492f568c9ef83bcd7a6686
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3413
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-26 07:27:19 +00:00
Máximo Castañeda
8c78892580 BFileGameSound: don't copy garbage after track end
Check for the end of track, as the stream is repositioned on the first
frame, the start of which we were copying to the buffer if there was
space left, whether we were looping or not.

Solves #16592

Change-Id: Ic49d1776577b71a4451775876597b9c9003e1d35
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3411
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-24 14:02:30 +00:00
Adrien Destugues
bc8445142d BSecureSocket: use openssl's default paths for certificates.
It is confusing to use different sets of certificates for BSecureSocket
based apps and ones using openssl directly. So, use the defaults in
BSecureSocket.

OpenSSL was modified to keep the user certificates in non-packaged so
this does not change the behavior for native apps (needs openssl 1.1.1g-3)

Change-Id: Ic398eec5efa9d036c3b810b7a3bb7142bdeb2d46
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3394
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-22 19:19:20 +00:00
Adrien Destugues
a6c8647e0a Tracker: list item height must be an integer.
The item height is rounded to the nearest integer when drawing, but it
is also used to compute an item position:
position in pixels = item number * height

If the height is not an integer, this leads to a rounding error, and
depending on how the items are drawn, some of them are shifted up by a
pixel because of it.

The fix is to round up the item height when it is first computed, and
then make all computations keeping integer values.

Fixes #16377.
2020-11-18 22:36:49 +01:00
X512
529fedc75c Interface kit: Resize menu if invalidated.
Change-Id: I45a966b13be6953431a1176378e4ddc10920916b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2325
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
2020-11-16 15:09:34 +00:00
Murai Takashi
6c016dc54a libnetapi: Fix use after free
Fix 'fImpl' is used after delete in BNetBuffer::operator=
(GetImpl() returns fImpl), when it is used with self assignment.
Pointed out by Clang Static Analyzer.

Change-Id: Ic80a4ce73879062581b9241f84a4340919d281b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3393
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-15 20:05:58 +00:00
Jérôme Duval
b05d6f0af0 POSIX: asprintf and vasprintf are BSD/GNU extensions
fix #16259

Change-Id: Ia16bb6e1944b87b25d1a940bbdaaf6e236db1abf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3381
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-07 08:49:34 +00:00
John Scipione
7c095f4709 BeControlLook: Fix app integration drawing issues
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>
2020-10-11 15:50:18 +00:00
Jérôme Duval
06ed32b8c4 BCursor: add a constructor with bitmap and point
* enhancement #15169
* get_mouse_bitmap(): also reads the colorspace from app_server.
* docs and tests

Change-Id: Iba63f8a2789530ae596c30b92f14828f31761d98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3292
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-08 08:23:31 +00:00
John Scipione
b76afa5bc0 BTextView: Draw string even if foundTab
Fixes #16544 (regression from hrev54549.)

Change-Id: Icca0b50f5432351b9c7ffcb82b1c8195a7ed286b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3267
Reviewed-by: humdinger <humdingerb@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-26 16:37:02 +00:00
Alexander G. M. Smith
a22fa0c977 package kit: Add pre-uninstall scripts feature.
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>
2020-09-21 10:47:57 +00:00
Pascal Abresch
99d96cefd9 TLS: add user cert dir
BSecureSocket currently only checks for trust anchors in the CA file,
this change will add the openssl certs/ directory as a trust anchor dir.
this matches the behaviour openssl has on the commandline and allows
users to install their own trust anchors to verify against for TLS

Change-Id: I9db5c3f3b063607e092dded3d5b141dba340a8e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3207
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2020-09-14 19:07:17 +00:00
John Scipione
fe88ae51ec AppKit: BMessage Add/Find/Get/Has/ReplaceNodeRef
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>
2020-09-10 17:18:09 +00:00
Adrien Destugues
9aea709dda Input prefs: handle errors
Various error handling cases were missing, which would lead to corrupt
settings and crashes. Add the missing error checks and make sure we
always revert to sane settings in case of problems.

Change-Id: Ib72621d6e4974345f5f6ee88e01a918cbf09d7ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3069
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
Preetpal Kaur
02ad22d6c8 Input: declare BString to get the Mouse Name
Change-Id: I3476f58839202a6fd8c93e325a15045963a9b7b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3125
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
Preetpal Kaur
37d793236c Added get_set_mulitple_mouse_type() functions
Change-Id: I95f85a15a77c3a548bb672cb966ae7b13fcefcc8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3127
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
Adrien Destugues
8f5c207181 Avoid Tracker crashes when input_server is broken
Missing error checks when calling input_server can lead to Tracker
crashes.
Add the missing error checks.

Thanks to mmlr for helping investigate the problem!

Change-Id: Ie7f3e00c1267b594eafc77a1613e186cf38e5277
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3068
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
John Scipione
d9385a9d38 IK: align BTextView text rect/fix alignment
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>
2020-09-07 22:10:36 +00:00
Adrien Destugues
41853a8bbf locale kit: allow creating a catalog without entry_ref
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>
2020-09-01 18:14:57 +00:00
John Scipione
6148533ec2 Revert "BTextView: remove useless and heavy computation"
This reverts commit ca6302dded.
2020-08-23 00:09:46 -04:00
Augustin Cavalier
bafb111359 Debugger: Add B_CLONEABLE_AREA to printed flags.
The helptext already displayed "c" as "cloneable",
it just was not actually added here as such.
2020-08-22 17:18:06 -04:00
John Scipione
22758f1690 Revert "IK: align BTextView text rect/fix alignment"
This reverts commit a9b301871d.

hrev54496

Change-Id: Ife3c834ad98d330f04976d9adf3b1553e7aca034
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3153
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-08-19 03:38:41 +00:00
Adrien Destugues
6d9c0146a5 BGradient: fix assignment operator, add copy constructor
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>
2020-08-11 20:46:34 +00:00
John Scipione
a9b301871d IK: align BTextView text rect/fix alignment
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>
2020-08-06 11:51:15 +00:00
Adrien Destugues
ca6302dded BTextView: 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.

This may cause regressions, the TODO here is very old and I don't know
to which "other parts of the code" it refers. Possibly they were
rewritten, possibly not. In any case, there is no point in keeping this
nonsense initial text rect computation, it's better to fix the actual
problems.

Fixes #5582 (which was not locale-related, after all)
2020-08-05 18:39:28 +02:00
Adrien Destugues
0d1f89e1a3 TranslatorRoster: avoid a deadlock when launching BeLive
If be_app is not running yet, trying to lock it may easily end up in a
deadlock.

Fixes #2105

However, as a result of this, when this situation happens, the
translator roster will not be node monitoring added/removed translators.
This was already the case if BTranslatorRoster::Default was called
before BApplication constructor, now it's also the case if called inside
the BApplication constructor or from another thread before it finished
running.

Maybe BTranslatorRoster should try to register itself later on if it
detects this. But it's acceptable to have the app not monitor
translators, because adding and removing translators isn't a very common
occurence and restarting the app to get it to notice them is probably
ok.
2020-08-05 15:39:19 +02:00
Adrien Destugues
9027ca04e2 Tracker: fix infowindow resizing
Fixes #16053
2020-08-05 14:40:06 +02:00
Adrien Destugues
1bad1ff34a Prepare for ICU update
- libicule and libiculx do not exist anymore in newer ICU versions
  (harfbuzz replaces them), but we didn't actually use them, so remove
  them from the build feature and from the package dependencies
- Add namespace usage marcos since the newer ICU packages put ICU things
  in a namespace, making it easier to have multiple versions of ICU used
  side by side.

No functional change intended, but this makes it possible to build the
code with either ICU 57 (for gcc2) or 66 (for other architectures).
2020-08-02 11:58:14 +02:00
Augustin Cavalier
d548fb2b3e Tracker: Rework BFilePanel compatibility code.
Instead of adding "dummy views", leave the original views intact
and just add a resizing hack to take care of any movements that
apps have inflicted.

Fixes #16411, a crash in WonderBrush, and compatibility issues
in some other applications.
2020-07-28 21:53:19 -04:00
Augustin Cavalier
a06b52bee8 BScrollView: Revert to earlier document-window adjust behavior.
We need a different constant or mechanism to get the document
window border size, it appears, or a static method to get
a scroll bar's preferred size.

Should fix #16422.
2020-07-28 21:04:24 -04:00
Emir SARI
60a6f1d5d7 Set Noto Sans Mono as monospace default font
Should help improve [1].

[1]: https://github.com/haikuports/haikuports/issues/3116

Change-Id: I29dd94e3380c3a5935d47d97e2a2ac1c5fb7e774
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3070
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-07-28 16:42:18 +00:00
X512
6aee9d6424 Tracker: fix count view border problem
Fixes #16439.

Change-Id: If936517a0ecfaba994f5d48fcc2fd159cb8ea11f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3093
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-26 03:07:11 +00:00
Leorize
7bac04e684 HttpRequest: Don't wait for socket to be readable
The socket is a blocking one, which means Read() will block unless data
is available, thus WaitForReadable() is useless in this context.

Testing also shows a 2x performance increase from removing this call due
to poll() performance being botched when KDEBUG_LEVEL >= 2.

Change-Id: I3170f865e961112b420c1548726bb6fd38e94cb2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3078
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00
Leorize
846c12f5df HttpRequest: Use an ArrayDeleter to manage the temporary buffer
This make sure that the temporary buffer will always be deleted should
any premature return happens.

Change-Id: I448ec7c3f3eeca1ef2b6473b49323f34bcb7bf86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3077
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00
Leorize
0d0f613f17 GopherRequest: Don't wait for socket to be readable
Instead we can trigger a Read() immediately, as our socket is blocking
and won't return until some data has been made available. This avoids a
potentially costly syscall in the loop body.

Change-Id: I899f55ede41af7cb7e9311aa04006b33c40d3ee4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3076
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00
Leorize
d64d305cf6 GopherRequest: Accurate progress reports and listener bugfixes
This commit brings the following changes:
- DownloadProgress() should now be reported for every DataReceived()
calls, similar to other BUrlRequest classes.
- Properly verify whether a listener has been set before invoking them.

Change-Id: I4ded82e318ba580b8869c3d1751da4e36882c39f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3075
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00
Leorize
2056d60ff1 DataRequest: Use ArrayDeleter to manage the temporary buffer
This simplify the clean up code path and make sure that the temporary
buffer will always be freed on exit.

Change-Id: I70c1a25bfa66c4f4a96dd3d0af3765a67e305fb2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3074
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00
Leorize
e1de8e8c21 DataRequest: More consistent progress report
Trigger DownloadProgress after DataReceived, similar to how other BUrlRequest
classes behave.

Change-Id: I4858c3736b1b1ebec55af9903dbfd4b976a77df3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3073
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00
Leorize
9e404c539f FileRequest: More consistent progress reporting
Make BFileRequest reports download progress after every DataReceived()
calls.

DownloadProgress() format has also been changed to use 0 as
`bytesTotal` when the total size is unknown. This is similar to
BHttpRequest functions currently.

Change-Id: I2920ea00c4f841bb666425be6f8da418e913c727
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3072
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-25 18:13:20 +00:00