Commit Graph

124 Commits

Author SHA1 Message Date
Ingo Weinhold e20dc8a7b7 Added missing convenience methods for unsigned integers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31187 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 21:43:06 +00:00
Stephan Aßmus 19e179ca4f * Moved the implementation of SetViewCursor from the thread of the
window of the view into the application thread. This solves the
  race condition with asynchronous SetViewCursor and deleting the
  cursor immediately afterwards for real.
* The ServerApp now requires a reference to the current cursor,
  just in case...
* Added TODOs for caching the BView token, it's currently resolved
  for every single BView call that talks to the server... not good!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 12:11:49 +00:00
Stephan Aßmus 5d62f8e0e5 Make it possible to properly use operator= on BCursors by making sure the
reference counting is maintained correctly in the app_server. While reviewing
this code, I have my doubts that my previous solution for handling pending
SetViewCursor() calls is always working as it is intended.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31131 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 10:10:01 +00:00
Ingo Weinhold a01a4cb9d4 Should have been part of r30624: Renamed _SniffFile() to _GetFileType().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-04 13:37:03 +00:00
Rene Gollent 5ca7bf5f96 Adding const for gcc2 as well shouldn't cause any issues. Thanks Axel!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29123 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 23:28:37 +00:00
Michael Lotz 6eb09230ba * Resolve further warnings on GCC4.
* Enable -Werror on GCC4 builds as well (limited to the same selected targets).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29118 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 22:12:55 +00:00
Rene Gollent 4c9838d0e4 Remove trailing spaces and add one more needed const.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 21:30:25 +00:00
Rene Gollent 85298c49be value_info needs that change also.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29115 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 21:05:31 +00:00
Rene Gollent 306fddc54a On gcc4 these need to be declared const. Otherwise any and every app that simply sets up a bunch of property_info structs for its scripting directives triggers many many warnings with respect to deprecated string constant conversions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29114 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 21:02:36 +00:00
Michael Lotz 3c6372b44a Rename BMessage::CompareData() to HasSameData() as this makes more sense for the
bool return type. Did I mention this was an unstable Haiku extension?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-16 20:45:12 +00:00
Michael Lotz 5b25b917f9 Introduce BMessage::CompareData() which is a Haiku API extension. It compares
the data of two BMessages and allows recursive comparison (BMessage inside
BMessage). Note that using this API might require you to recompile your app in
the path to R1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28174 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-16 15:55:36 +00:00
Axel Dörfler f20a8750cb * Enlarged the default BLooper port capacity to 200 messages. Since limiting
the message count doesn't really make much sense anyway (as opposed to
  limiting the maximum size of waiting messages), we might still want to
  enlarge this even more.
* This should further help with #2212.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25709 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 18:24:19 +00:00
Michael Lotz a433b9febf Rewrite and activate message passing by area. Passing by area works now with
the new sematic of transfer_area so a message area is transfered into the right
teams' address space and it does not need to be cloned there anymore. Passing
by area is only used for messages bigger than a certain size (currently
hardcoded to 40KB) which should be somehow bound to the max port message size.
This makes passing large messages (i.e. > the port limit) possible, so for
example copy&paste of long text, image data, etc. should now work.
Got rid of the fClonedArea member as it is not necessary with the new design,
renamed shared_area to message_area in the private message_header, avoid
an unnecessary allocation of the header for the copy constructors, check
allocations in a few more places and some minor cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24321 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 13:35:41 +00:00
Jérôme Duval f2e230ca88 fix a bit of gcc4 build
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22578 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-15 22:35:52 +00:00
Axel Dörfler f6e4cbb952 * Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22577 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-15 20:13:55 +00:00
Axel Dörfler eaad52e8d7 Now uses the cache stack trick for a cheaper check_lock() version as suggested by stippi.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21863 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-08 22:43:52 +00:00
Axel Dörfler 70fa61adbb * Removed the _IMPEXP* stuff from the headers Ingo clearly identified as ours.
* Removed storage/Alias.h as that stuff isn't even available on BeOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21576 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-06 10:35:17 +00:00
Axel Dörfler f9d99406ae Fixed build under Dano (and probably Zeta, too); our headers used entry_ref resp.
BDirectory without declaring it first. Since that's an actual bug, I made the
changes in the Haiku headers, and copied them back to the build headers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21562 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-04 23:20:05 +00:00
Axel Dörfler b418398455 * Removed _GetWindowList()
* _WindowAt() and _CountWindows() now have an individual version of that
  code which should be magnitudes faster.
* _WindowQuitLoop() no longer handles hidden windows specially - instead,
  it now walks the window list in the correct direction which should fix
  the issues.
* Also, it now uses WindowAt() and thus has an up-to-date view of the
  window list (it will no longer ignore new windows).
* And finally, it will no longer dereference an unsafe pointer (for
  BWindow::IsFilePanel()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21505 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-25 23:38:45 +00:00
Axel Dörfler 4231541414 * Implemented atomic commit support to the clipboard as described by #1187.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20919 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-30 10:50:15 +00:00
Axel Dörfler ffcc37a0aa * Added and implemented B_INVALIDATE as available on Dano; to invalidate only a certain
part of the view, you can add a BRect "be:area" to that message - very handy.
* Cleaned up AppDefs.h a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20683 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-14 18:11:42 +00:00
Axel Dörfler f6c0820638 * The BHandler observer mechanism was completely broken in Haiku for remote targets;
this fixes bug #1005. As a result, the Disks icon will now appear in file panels
  when you change that setting with a panel open.
* _ObserverList is now in the BPrivate namespace (and renamed to ObserverList).
* its BHandler map is now only temporarily used for handlers that do not belong to
  a looper yet; when BHandler::SendNotices() is called, they will be transferred
  into the BMessenger map.
* Invalid messengers are now removed from the map when encountered.
* Added TODO comments about a possible reference counting if a handler is added
  twice to a list (right now, this will be ignored).
* All {Start|Stop}Watching() methods are now more or less safe to be used in low
  memory situations (adding some items to the map can still throw an exception...).
* Renamed BHandler::InitData() to _InitData().
* Some refactoring and cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20029 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-02-01 16:08:01 +00:00
Axel Dörfler 9dbe170a69 Implemented direct message passing for local targets; this fixes a deadlock
with PostMessage() in case the message queue is full.
Some notes:
* for synchronous replies, we don't use this mechanism yet, but it could be
  extended to do that as well.
* the code looks so complicated because we need a way to access the looper's
  queue without locking it (to prevent deadlocks); like Dano's solution, I've
  abused BTokenSpace to store a BDirectMessageTarget with a BHandler.
* we also need to decouple the lifetime of a looper's queue from its target,
  as we cannot lock the looper, and therefore, can't guarantee it stays valid
  as long as we're accessing it outside of BLooper.
* init_clipboard() now needs to be done after the global constructors have
  been called - since sending messages now needs gDefaultTokens to be initialized.
  Since this is done per image, it shouldn't cause any troubles, though.
* some minor cleanup, removed unused _msg_cache_cleanup_() and friends.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19968 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-26 13:59:56 +00:00
Axel Dörfler c01f349e6d Cleanup:
* Got rid of unused BLooper members
* renamed fTaskID to fThread
* Removed private and deprecated AddLooper()/RemoveLooper()/... stuff; BLooper is now
  directly calling BLooperList methods.
* Got rid of extensive and useless comments
* Made a few TODOs more clear
* Merged InitData() and InitData(...) to _InitData(...)
* BLooper::Team() now uses BPrivate::current_team(), sTeamID is gone now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19966 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-26 12:42:18 +00:00
Axel Dörfler ca9b91886d * Added a Dano extension to BMessageQueue: IsNextMessage().
* BLooper::AddMessage() is now using this method to determine wether or not to
  update its looper thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19956 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-25 17:08:16 +00:00
Axel Dörfler c2f641f2e5 Turns out the whole "active app" mechanism in the registrar wasn't used at all; the
Switcher now works as expected.
* Renamed TRoster::ActivateApp() to UpdateActiveApp(), as the app is already activated
  at that point (the registrar only keeps track of it).
* BWindow::DispatchMessage() now calls the new BRoster::Private::UpdateActiveApp()
  method when it receives a B_WINDOW_ACTIVATED message.
* Added BRoster::_UpdateActiveApp() which calls the new B_REG_UPDATE_ACTIVE_APP.
* Removed now unused B_REG_ACTIVATE_APP.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19857 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-18 17:45:08 +00:00
Ingo Weinhold 6bfd06d1ff BRoster::Launch() eventually launches the application in question
in several steps:
1. early pre-registration with the registrar ("I wanna launch the
   app, make sure noone interferes.")
2. load the app image
3. finish pre-registration with the registrar ("I have launched
   the app, here is its team ID.")
4. start app main thread
5. send "on launch" messages to the app (argv, refs, others)

If the app is already running or being launched, 1. fails with a
conclusive error code and returns the team ID and the pre-registration
token of the app. Steps 2 - 4 are skipped and only the messages are
delivered using the team ID returned by 1.

This change fixes a race condition: The failed early pre-registration
request obviously cannot return the team ID, if the other thread
launching the app has not finished step 3 yet. Thus the argv/refs
message would not get delivered and Launch() would not return the
correct team ID.

Now we wait for the pre-registration to be finished in this case, using
the former _IsAppPreRegistered() mechanism, which already provided
such a waiting feature for one request. It has been extended to
accomodate an arbitrary number of waiting requests and renamed to
_IsAppRegistered().

This fixed bug #763.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18728 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-08-31 17:54:16 +00:00
Ingo Weinhold 9ecf9d1c1d Merge from layout management branch.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-08-26 16:21:15 +00:00
Jérôme Duval 67bdea52ce hope no one minds with this Dano-like version of BMessage::PrintToStream()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-07-10 20:00:07 +00:00
Jérôme Duval 6c61b2841f moved B_PROPERTY_INFO_TYPE definition to TypeConstants.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17907 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-22 12:21:46 +00:00
Axel Dörfler a6c9722d73 Some cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17840 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-14 18:31:15 +00:00
Axel Dörfler f025617d21 Forgot to commit this header - should have been part of r17785.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-10 09:25:30 +00:00
Axel Dörfler 783f7f20bd * Implemented support for node monitoring - you can now be notified when new
translators are installed via BTranslatorRoster::StartWatching().
* Fixed GetTranslatorData() - some hooks are only optional (this puts the
  JPEG, GIF, and some other translators back into the game).
* Made BTranslatorRoster::Default() thread-safe.
* Improved documentation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-29 18:02:46 +00:00
Axel Dörfler 6d5488e18a * There is now a server_read_only_memory structure that is placed in a (surprise!)
read-only area shared between the Desktop and all applications.
* Right now, this area only contains the desktop colors, ie. B_PANEL_BACKGROUND_COLOR
  etc.; ui_color() no longer needs to ask the server for these colors.
* The ui_colors are now maintained by DesktopSettings, though ColorSet is still there.
* The default colors are now hardcoded once and for everyone in InterfaceDefs.h, ie.
  the app_server uses them as well.
* Desktop::Init() can now also return an error (but that is not yet accounted for).
* Cleaned up InterfaceDefs.h.
* Fixed wrong include in moreUTF8.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-25 20:12:06 +00:00
Axel Dörfler 60bf6a1fbe Removed the detached version of the BMessageRunner object again, and instead
have a static method for spawning one (BMessageRunner::StartSending()), as
suggested by Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16966 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-02 14:47:01 +00:00
Axel Dörfler d3b71f5562 Who said I couldn't break the build?
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16827 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-18 14:43:29 +00:00
Axel Dörfler 43d7fe9753 * Added two new constructor forms that allow you to create a BMessageRunner
that is detached from its local object; ie. it will continue to send its
  messages when you delete the object.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16730 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-12 12:27:16 +00:00
Michael Lotz bdbd1cb441 Removing the USING_MESSAGE4 define.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16710 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-11 18:06:46 +00:00
Michael Lotz 2bf8fb3a96 Putting Message4 into place to become the new BMessage implementation. Will cleanup USING_MESSAGE4 now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16709 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-11 17:55:47 +00:00
Michael Lotz 16ba0dc5ca Removing old BMessage implementation. Message4 will replace it in the next commit.
This will allow to fix message related problems like drag and drop and scripting.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16708 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-11 17:52:56 +00:00
Stephan Aßmus 588259b66d various changes to handling custom cursors:
* all cursors owned by a team are visually different,
  or (iaw) an already existing cursor is reused when
  it is set by the client again
* changed various occurances of cursor data from "int8*"
  to "uint8*"
* ServerCursors also remember the R5 data from which
  they were created
* the reference counting and destruction of
  ServerCursors changed: The cursor knows it is attached
  to a CursorManager and one can simply use
  ServerCursor::Acquire() and Release() and the reference
  counting and everything is being taken care of
* destroying a ViewLayer will now correctly release a set
  ServerCursor
* fixed a race condition when setting a cursor through
  BView::SetViewCursor(): If the client code looks like this:

  BCursor cursor(cursorData);
  someView->SetViewCursor(&cursor, false);

  there is a relatively high chance the BCursor destructor
  told the ServerApp thread to destroy the cursor before
  the ServerWindow thread got to "acquire" the cursor for
  use by the view layer. The very same problem is likely the
  reason that SetViewCursor works to unreliably on R5, even
  when the "sync" flag is set to "true" (although it should
  theoretically work in that case).

all these fixes make WonderBrush work fine again with the
new support of custom cursors.... coded by axeld and myself
(the joys of pair programming :-)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16521 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-26 18:15:31 +00:00
Michael Lotz 6990418519 * Fixed some more bugs in the message passing by area
* Reordered some functions
* Area messages can now be unflattened instead of using the private _Reference and a special port code

Passing by area is now mostly working but it's not yet enabled. I will have to conduct performance tests first to see if and starting at what messagesize the overhead is reasonable.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-23 09:02:03 +00:00
Jérôme Duval 09dec1db1b cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16489 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-21 11:18:17 +00:00
Michael Lotz 721a0fe3e4 Started implementing message passing by area. This will be needed for drag & drop messages and will probably be used for large messages instead of sending them through a port. Not yet finished and not enabled. Cleaned up a part of BLooper - this class should probably be cleaned up completely.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16459 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-18 12:29:05 +00:00
Axel Dörfler eb797182df Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16430 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-16 17:37:36 +00:00
Axel Dörfler aa1f543799 Some work on cursors:
* Fixed a myriad of bugs all over the place, ranging from locking errors to
  deleting objects that don't belong to the one deleting them (hello HWInterface!)
* Almost all ServerWindow cursor stuff was broken; I've replaced all commands
  to set a cursor with a single one AS_SET_CURSOR.
* Renamed some cursor commands.
* Changed the (broken) way ServerApp::fAppCursor was maintained - the application
  cursor is now NULL as long as possible.
* Removed superfluous ServerCursor app signature stuff.
* The BApplication will no longer duplicate the default/I-beam cursors, it will
  just reuse the default ones which now have fixed tokens.
* As a result, changing the cursor is now working as expected, closing bug #102.
* Rewrote Cursor.h, renamed private members to match our style guide.
* Minor cleanup.

What's still left to be done is reference counting the cursor objects to make them
work right and reliable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-05 18:14:14 +00:00
Axel Dörfler 5edcfe9619 Cleanup!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-03 09:23:08 +00:00
Stefano Ceccherini 17adbf1f0c Misc style changes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-30 17:56:56 +00:00
Axel Dörfler 14d02d22f6 Huge cleanup and fixes:
* attachView() is now called _CreateSelf() and creates the app_server
  view counterpart for itself, and no longer for a child view.
* removed superfluous deleteView().
* moved drawing from BWindow::DoUpdate() to BView::_Draw().
* made the recursive hook call functions consistent.
* fixed BWindow::DispatchMessage() to send public messages to the intended
  target (instead of always handling them itself directly).
* DispatchMessage() no longer eats unmapped key events that were targeted
  at the window directly.
* B_KEY_DOWN and B_KEY_UP events are now send to the target view as well
  (this couldn't work before as BMessages were broken with B_PREFERRED_TOKEN).
* the default button is now correctly targeted by BWindow::_DetermineTarget()
  (previously, the enter key was hacked to get through via _HandleKeyDown()).
* removing a view now also makes sure it won't have focus any longer.
* also, the DetachedFromWindow() hooks are now called first, so that any
  changes made there cannot mess up our window anymore.
* removed BView::SetPattern(); _UpdatePattern() now does its job.
* renamend private methods to match our preferred style.
* removed unused methods and variables.
* more consistent naming overall.
* removed _PR3_COMPATIBLE_ stuff - there is definitely no need for us to be
  compatible to that one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-21 16:58:36 +00:00
Axel Dörfler 3cace414ad Removed run_task(), as it's not really needed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15057 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-21 12:35:30 +00:00