Commit Graph

857 Commits

Author SHA1 Message Date
Augustin Cavalier 0cdb323800 app_server & Application Kit: Fix bitmap cursor handling.
Using a memcpy here is supremely dangerous, because we are writing to
an app_server buffer that we chose the length for, but using a size
that came from the client. And, indeed, because the buffer can contain
padding if the BBitmap was allocated with a non-standard BytesPerRow,
we will overflow the buffer and corrupt memory, causing app_server to crash.

So, instead, reorganize parameters a bit, and pass BytesPerRow along
with the other data needed to instantiate the bitmap, and then use
ImportBits.

Fixes an app_server crash I triggered with the experimental libX11
compatibility layer.
2021-12-11 21:44:59 -05:00
François Revol df026fdf16 BMessage: fix typos 2021-04-24 12:55:17 +02:00
Murai Takashi e459857d1c BMessage: Fix declared variable-length array has negative size
Add checks for value of 'size', since FlattenedSize() may return
negative value (B_NO_INIT).
Pointed out by Clang Static Analyzer.

Change-Id: I68176ee47076512a0b96539f9986ac5edbb587af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3772
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-13 09:16:47 +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 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
X512 9bc51ee07c BLooper: implement scripting
Change-Id: I73dd301ca7109675a4b629464ba7275a8095c77b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2940
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-24 14:08:28 +00:00
Niels Sascha Reedijk 02e45e32ae HaikuBook: Initial documentation for BNotification
The implementation file contained some documentation. This has been moved
to the Haiku Book (and is rewritten in most cases). The documentation gives
some insight on how the notification_server works.

Change-Id: I82bafcf57101d4882bdf07e7f731df9cd8adc861
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2299
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-02 22:10:04 +00:00
Jérôme Duval feeb4b5d93 RosterPrivate: add IsShutDownInProgress()
enable to check whether a shutdown process is in progress.

Change-Id: I8efdddb3caa80e9fd188f202b6e92a888a7608e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2042
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-12-21 20:32:31 +00:00
Adrien Destugues d761df9f70 BMessage: fix NULL pointer dereference in out of memory condition.
Change-Id: I75ba6e5069cda8a92fd88bf7d1e999232359e73c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1864
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-14 20:06:18 +00:00
Adrien Destugues 4eaa1f35e5 BRoster: preserve symlink as "app" if given one
Symlink name or attributes may be relevant to the launched app, so it's
important that we pass the unresolved symlink as argv[0] when running
it.

Change-Id: Ie1d73bc4e9d5c3d0476f205ce635aafd9203e553
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1739
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-24 16:28:45 +00:00
Adrien Destugues 6faf979da7 BRoster: Fix infinite loop when trying to launch app with missing libraries.
Fixes #14986.

Change-Id: I727fde0c475f0684567a46be5af616cad56a9b4c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1738
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-24 16:28:45 +00:00
Augustin Cavalier 96e64e6e14 Application Kit: Add B_CLONEABLE_AREA permission to cloned server areas.
The Media Kit needs this for overlays.
2019-08-11 15:27:51 -04:00
CodeforEvolution 2846db2e99 Implement is_app_showing_modal_window()
Also do some cleanup in private headers, I can't imagine why the build
libraries would need this function.

Change-Id: Ib08810b6efe4738dad596a735d741582a3781b28
Reviewed-on: https://review.haiku-os.org/c/1670
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
2019-08-03 00:41:10 +00:00
Jérôme Duval d2e519391f Messenger: style fix.
Change-Id: I5b1b7e745de91bd1bedbbbe13faf848fdd284785
Reviewed-on: https://review.haiku-os.org/c/1565
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-07-08 18:53:48 +00:00
Augustin Cavalier ebb0db62d1 kits: Only export private dummy copy constructors for R5 ABI.
Fixes #546 (after all these years!)
2019-07-04 15:24:23 -04:00
Augustin Cavalier f7397837e8 BMessage: Use assignment operator instead of memcpy().
The only non-POD types the macro is used on are BPoint, BRect, BSize,
and rgb_color, so the first change should essentially be a no-op.

The second change will technically have different behavior,
as the BMessenger copy constructor does not touch the _reserved_
field; but this shouldn't break anything, of course.
2019-05-24 14:28:19 -04:00
Augustin Cavalier ad38b80fd5 BMessage: Fix R5 checksum calculation on 64-bit.
Change-Id: I0d418883bb66c6ad9e351c955e213f5cbc975e56
Reviewed-on: https://review.haiku-os.org/c/1336
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-31 17:39:11 +00:00
Augustin Cavalier 5ffbe7d778 Change all references to "__INTEL__" to "__i386__".
They are functionally identical, but the former is a BeOS/Haiku-specfic
macro that we include in the compiler specs, and the latter is defined
by GCC.
2019-03-30 16:54:01 -04:00
Murai Takashi 5f48948f7f Roster: Fix PVS 460
Replace do...while(false) loop with while(true)... loop,
so that 'continue' at line 1968 can continue loop.

Change-Id: I4d64ff2699ad0837f29d49c63b683b134c4ccc1e
Reviewed-on: https://review.haiku-os.org/c/1149
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2019-03-05 22:39:24 +00:00
Augustin Cavalier c5e4e4ffb4 headers/kernel: Include declarations of initialization functions in image.h.
No "real" functional change, but this causes GCC7 to throw errors when
these functions are declared without the image_id argument, which
in some files they were (as this commit repairs.)

This change is largely inconsequential on x86, but on callee-cleanup-args
targets, leaving out the argument would probably cause stack corruption.
2019-02-01 20:30:39 -05:00
Murai Takashi ab6bcb08bc Roster: Fix PVS 456-459
Remove unneed if condition, since 'error' is initialized to B_OK.

Change-Id: I2fd0edb99a3d055beafaf15f1140071a31140892
Reviewed-on: https://review.haiku-os.org/798
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2018-12-25 17:49:46 +00:00
Augustin Cavalier 9effbd7e00 Remove some unused cruft from the early days.
These lines were added in 2002...
2018-12-15 20:26:13 -05:00
Adrien Destugues 151343ebc8 BLooper: API to hijack existing thread.
I need this to use loopers in WebKit, which spawns threads and expects
to be able to turn them into event loops later on.

This is the pattern already used in BApplication, we may as well make it
available elsewhere.

Change-Id: I5939ca89d33cb3bcc92567b302c2038d976af598
Reviewed-on: https://review.haiku-os.org/735
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-02 21:36:31 +00:00
Augustin Cavalier 8636e31a55 BNotification: Fix copy-n-paste bug in OnClickRefAt.
Fixes #14405.
2018-08-26 13:48:51 -04:00
Jérôme Duval 27bba9c3fe registrar: flat_app_info size was arch dependent.
copy each member of app_info instead.

Change-Id: Ica8d0a195b2dbaaf57d28f2fe2f7efd73c37b2c4
2018-05-05 09:30:08 +00:00
Axel Dörfler a77aa747ea launch_daemon: Added basic logging facility
* The daemon now stores many events in am internal log.
* You can use "launch_roster log" to retrieve it.
2018-04-25 10:10:43 +02:00
Jérôme Duval 09320f38d7 Roster: fix debug build on x86_64. 2018-03-10 16:03:13 +01:00
Axel Dörfler 08a4536b1f BMessage: Added missing [Get|Set]Pointer()
* SetPointer() was declared, but not defined.
2018-01-29 21:43:21 +01:00
Axel Dörfler e96835a9a4 Added simple test_launch_daemon.
* Expects its config files in /boot/home/test_launch.
* Uses standard I/O, and is always in user mode.
* Also added test_launch_roster command that is able to talk to the test
  server like it does to the real thing.
2017-11-29 17:19:46 +01:00
Humdinger 16af9b4c61 Style, no functional changes
Make termination consistant with that last commit hrev51521.
As wished and proof-read by waddlesplash. Hope all's well...
2017-11-16 19:47:59 +01:00
Brian Hill 8856b51897 BNotification ABI padding
Add reserved functions and data to avoid future ABI breakage
2017-09-28 22:19:05 -04:00
Brian Hill 6aa0587222 Notifications preflet and notification_server
Notifications preflet:
-Use sliders instead of text fields for width and timeout
-Remove icon size choice (mini icon looks horrible)
-Consolidate both "Enable" checkboxes into one
-Fix Revert button, remove Apply button, add Defaults button
-All changes to settings saved immediately
-Live example notification message shown when settings changes are made
-Add setting for individual apps to specify whether their notifications
	should be muted
-Remove history list (to be implemented later)

BNotification class:
-BNotification records the signature and name of application that
	created it
-New functions to get source application signature and name

Notification Server:
-Notification pop up view layout fixes and bold font size fix
-Remove notifications history from AppUsage class (will be saved in
	cache instead)
-Remove vector of NotificationView objects which isn't needed
-Get source application info from notification object, not the received
	message which is not reliable
2017-09-23 11:41:33 -04:00
Adrien Destugues 1416521f10 Notifications: default to application icon.
It is possible to SetIcon(NULL) to remove it.
But in msot cases we want the application icon to be the default.

as discussed in #13590.
2017-07-22 16:11:25 +02:00
Axel Dörfler 852e09d61f launch_daemon: Added stop target ability.
* Before, you had to stop each job by itself.
2016-11-29 23:14:36 +01:00
John Scipione 22097d7aee Style fixes to BPeropertyInfo class 2016-04-27 11:10:34 -07:00
Axel Dörfler 90fd6af0b6 launch_daemon: Added ability to enable/disable a job.
* Instead of just starting/stopping it.
* Also available via the launch_roster command.
2016-01-12 16:22:47 +01:00
Augustin Cavalier 3592932936 BApplication: Remove added PrintToStream().
Another missed debugging snippet from the merge.
2016-01-04 18:52:41 -05:00
looncraz 2567fac21d app_server: Fix for LinkReciever.
LinkReceiver would spin endlessly when given a timeout value which prevented
DelayedMessageSender from being operational.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Patch 0002 from looncraz, unmodified.
2016-01-04 13:37:33 -05:00
looncraz 7f9368cae5 Set*UIColor, etc.
The inseparable changes necessary to support live color updating across the
system in a sane, safe, and performant manner.

BView gains:

HasSystemColors()
HasDefaultColors()
AdoptSystemColors()
AdoptParentColors()
AdoptViewColor(BView*)
SetViewUIColor(color_which, float tint)
SetHighUIColor(...
SetLowUIColor(...
ViewUIColor(float* tint)
HighUIColor(...
LowUIColor(...
DelayedInvalidate()

BWindow gains a simple helper method:
IsOffscreenWindow()

BMessage gains:

AddColor()
FindColor()
GetColor()
HasColor()            * allegedly this API is deprecated, but I implemented it anyway
ReplaceColor()
SetColor()

Previous private ColorTools methods are made public and moved into GraphicsDefs:

mix_color, blend_color, disable_color

These are fully compatible with BeOS dan0 R5.1 methods and are just code cleanup
of BeOS example code under the OpenTracker license.

In addition, four new colors are created:
B_LINK_TEXT_COLOR
B_LINK_HOVER_COLOR
B_LINK_ACTIVE_COLOR
B_LINK_VISITED_COLOR

These changes are documented in their proper user documentation files.

In addition, due to a history rewrite, B_FOLLOW_LEFT_TOP has been defined and
used in lieu of B_FOLLOW_TOP | B_FOLLOW_LEFT and is included in this commit.

On the app_server side, the following has changed:

Add DelayedMessage - a system by which messages can be sent at a scheduled time,
and can also be merged according to set rules.  A single thread is used to service the
message queue and multiple recipients can be set for each message.
Desktop gains the ability to add message ports to a DelayedMessage so that
said messages can target either all applications or all windows, as needed.

Desktop maintains a BMessage which is used to queue up all pending color changes
and the delayed messaging system is used to enact these changes after a short
period of time has passed.  This prevents abuse and allows the system to merge
repeated set_ui_color events into one event for client applications, improving
performance drastically.

In addition, B_COLORS_UPDATED is sent to the BApplication, which forwards the message
to each BWindow.  This is done to improve performance over having the app_server
independently informing each window.

Decorator changes are live now, which required some reworking.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2016-01-04 06:48:22 -05:00
Dario Casalinuovo 05962bb1e1 Add a way to register loopers for quit
* BApplication can now take the job to quit a BLooper at
the application quit. It's rejecting requests from windows too.
* BMediaRoster is using now this service in conjunction with the
MediaRosterUndertaker.
* The BeBook specify that we should have a valid BApplication
before to instantiate the BMediaRoster. While in theory we should
add a debugger call when this situation happens, in pratice this
might lead to more problems. For example libraries might use the
media_kit and create a BApplication object, but they aren't
applications, this is a design problem. So I decided to replace it
with a TRACE call for the moment.
2015-11-28 16:35:03 +01:00
Axel Dörfler 9e73b62749 launch_daemon: Fixed preregister consequences.
* Since the last change, the user launch_daemon would talk to the
  registrar again.
* However, this also caused BRoster::Launch() to preregister the app,
  which messed up our preallocated port.
* BRoster::Private::Launch() now allows to get the port that the
  registrar created in such a case, and the launch_daemon will now just
  use that one as default port.
* This lets us talk to the Deskbar again, and should fix #12455, as
  well as #12454 (again).
2015-11-11 16:04:02 +01:00
Julian Harnath 6109a2086d Merge branch 'app_server'
Conflicts:
	src/kits/interface/PicturePlayer.cpp
	src/servers/app/ServerPicture.cpp

In addition, the following files were also adapted to master branch
BPicture changes during the merge:
	src/kits/interface/PicturePlayer.h
	src/servers/app/PictureBoundingBoxPlayer.cpp
2015-11-10 23:09:54 +01:00
Axel Dörfler 5860caae39 launch_daemon: Added basic ability to stop/start jobs via API.
* Stopping a job is very simplistic right now, and will have to be
  extended considerably, probably with its own job.
2015-11-07 21:58:12 +01:00
Axel Dörfler 3282b758b0 launch_daemon: Add API to get information on jobs.
* Ie. a listing of all targets/jobs, as well as specific (basic) info
  on each.
* Also added a bit of optional debug output.
* Moved translating the path to launch time -- we should take the job's
  environment into account here at some point.
2015-11-06 22:47:56 +01:00
Axel Dörfler 2e17b6504f BLaunchRoster::ResetStickyEvent() added.
* Used to unflag sticky events that already have been triggered once.
2015-10-25 14:41:17 +01:00
Axel Dörfler 7cd19b7e5c launch_daemon: Implemented sticky events, and registration.
* Sticky events are events that keep their signal raised, ie. even if
  a job is initialized afterwards, it will still be triggered.
* Consolidated naming for external events.
* Events are now registered once they are actually being used. This
  allows them to allocate the resources they need to do their thing.
2015-10-17 14:16:26 +02:00
Julian Harnath 71cc4d4998 Merge branch 'master' into app_server
Conflicts:
	src/kits/app/Roster.cpp
2015-09-01 20:07:21 +02:00
Michael Lotz c0c883cf8e BMessage: Fix precedence of KMessage vs. size check.
A KMessage request always needs to be honoured, regardless of the data
size.

KMessage does not currently protect against messages that are too large,
but this needs to be solved in KMessage when it becomes a problem.
2015-08-29 11:25:46 +02:00
Michael Lotz 5b9f6b5485 BRoster: Add launchSuspended option to _LaunchApp().
It allows to launch the app, but keep its main thread suspended instead
of automatically resuming it.

Also add appThread argument which allows to retrieve the main thread of
the launched team.
2015-08-28 22:52:50 +02:00
Michael Lotz ee5575d9b3 BRoster: Apply no-registrar mode in a few more cases.
Avoids some more attempts at communicating with the registrar if the
no-registrar flag has been set.
2015-08-26 22:23:59 +02:00