We're now using the same priorities for windows as BeOS does - this should improve
the responsiveness of the GUI, and should also fix bug #742. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
* Stefano Ceccherini ([email protected])
|
* Stefano Ceccherini ([email protected])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
|
|
||||||
using BPrivate::gDefaultTokens;
|
using BPrivate::gDefaultTokens;
|
||||||
|
|
||||||
|
|
||||||
struct menubar_data {
|
struct menubar_data {
|
||||||
BMenuBar *menuBar;
|
BMenuBar *menuBar;
|
||||||
int32 menuIndex;
|
int32 menuIndex;
|
||||||
@@ -34,9 +36,9 @@ struct menubar_data {
|
|||||||
|
|
||||||
|
|
||||||
BMenuBar::BMenuBar(BRect frame, const char *title, uint32 resizeMask,
|
BMenuBar::BMenuBar(BRect frame, const char *title, uint32 resizeMask,
|
||||||
menu_layout layout, bool resizeToFit)
|
menu_layout layout, bool resizeToFit)
|
||||||
: BMenu(frame, title, resizeMask,
|
: BMenu(frame, title, resizeMask, B_WILL_DRAW | B_FRAME_EVENTS, layout,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS, layout, resizeToFit),
|
resizeToFit),
|
||||||
fBorder(B_BORDER_FRAME),
|
fBorder(B_BORDER_FRAME),
|
||||||
fTrackingPID(-1),
|
fTrackingPID(-1),
|
||||||
fPrevFocusToken(-1),
|
fPrevFocusToken(-1),
|
||||||
@@ -349,7 +351,7 @@ BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *speci
|
|||||||
fMenuSem = create_sem(0, "window close sem");
|
fMenuSem = create_sem(0, "window close sem");
|
||||||
_set_menu_sem_(window, fMenuSem);
|
_set_menu_sem_(window, fMenuSem);
|
||||||
|
|
||||||
fTrackingPID = spawn_thread(TrackTask, "menu_tracking", B_NORMAL_PRIORITY, NULL);
|
fTrackingPID = spawn_thread(TrackTask, "menu_tracking", B_DISPLAY_PRIORITY, NULL);
|
||||||
if (fTrackingPID >= 0) {
|
if (fTrackingPID >= 0) {
|
||||||
menubar_data data;
|
menubar_data data;
|
||||||
data.menuBar = this;
|
data.menuBar = this;
|
||||||
|
|||||||
@@ -293,11 +293,8 @@ BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
|
|||||||
data->lock = sem;
|
data->lock = sem;
|
||||||
|
|
||||||
// Spawn the tracking thread
|
// Spawn the tracking thread
|
||||||
fTrackThread = spawn_thread(entry, "popup", B_NORMAL_PRIORITY, data);
|
fTrackThread = spawn_thread(entry, "popup", B_DISPLAY_PRIORITY, data);
|
||||||
|
if (fTrackThread < B_OK) {
|
||||||
if (fTrackThread >= 0)
|
|
||||||
resume_thread(fTrackThread);
|
|
||||||
else {
|
|
||||||
// Something went wrong. Cleanup and return NULL
|
// Something went wrong. Cleanup and return NULL
|
||||||
delete_sem(sem);
|
delete_sem(sem);
|
||||||
if (async && window != NULL)
|
if (async && window != NULL)
|
||||||
@@ -306,6 +303,8 @@ BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resume_thread(fTrackThread);
|
||||||
|
|
||||||
// Synchronous menu: we block on the sem till
|
// Synchronous menu: we block on the sem till
|
||||||
// the other thread deletes it.
|
// the other thread deletes it.
|
||||||
if (!async) {
|
if (!async) {
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
//#define DEBUG_WIN
|
//#define DEBUG_WIN
|
||||||
#ifdef DEBUG_WIN
|
#ifdef DEBUG_WIN
|
||||||
# include <stdio.h>
|
|
||||||
# define STRACE(x) printf x
|
# define STRACE(x) printf x
|
||||||
#else
|
#else
|
||||||
# define STRACE(x) ;
|
# define STRACE(x) ;
|
||||||
@@ -269,7 +268,7 @@ BWindow::Shortcut::PrepareKey(uint32 key)
|
|||||||
|
|
||||||
BWindow::BWindow(BRect frame, const char* title, window_type type,
|
BWindow::BWindow(BRect frame, const char* title, window_type type,
|
||||||
uint32 flags, uint32 workspace)
|
uint32 flags, uint32 workspace)
|
||||||
: BLooper(title)
|
: BLooper(title, B_DISPLAY_PRIORITY)
|
||||||
{
|
{
|
||||||
window_look look;
|
window_look look;
|
||||||
window_feel feel;
|
window_feel feel;
|
||||||
@@ -281,7 +280,7 @@ BWindow::BWindow(BRect frame, const char* title, window_type type,
|
|||||||
|
|
||||||
BWindow::BWindow(BRect frame, const char* title, window_look look, window_feel feel,
|
BWindow::BWindow(BRect frame, const char* title, window_look look, window_feel feel,
|
||||||
uint32 flags, uint32 workspace)
|
uint32 flags, uint32 workspace)
|
||||||
: BLooper(title)
|
: BLooper(title, B_DISPLAY_PRIORITY)
|
||||||
{
|
{
|
||||||
_InitData(frame, title, look, feel, flags, workspace);
|
_InitData(frame, title, look, feel, flags, workspace);
|
||||||
}
|
}
|
||||||
@@ -350,9 +349,8 @@ BWindow::BWindow(BRect frame, int32 bitmapToken)
|
|||||||
|
|
||||||
BWindow::~BWindow()
|
BWindow::~BWindow()
|
||||||
{
|
{
|
||||||
if (BMenu *menu = dynamic_cast<BMenu *>(fFocus)) {
|
if (BMenu *menu = dynamic_cast<BMenu *>(fFocus))
|
||||||
menu->QuitTracking();
|
menu->QuitTracking();
|
||||||
}
|
|
||||||
|
|
||||||
// The BWindow is locked when the destructor is called,
|
// The BWindow is locked when the destructor is called,
|
||||||
// we need to unlock because the menubar thread tries
|
// we need to unlock because the menubar thread tries
|
||||||
|
|||||||
Reference in New Issue
Block a user