* src/haiku_support.cc (class EmacsWindow): New field `z_group'.
(RecomputeFeel): New function.
(ParentTo, BWindow_set_override_redirect): Use that instead
instead of manually juggling the window feel around.
(BWindow_set_z_group): New function.
* src/haiku_support.h (enum haiku_z_group): New enum.
* src/haikufns.c (haiku_set_parent_frame): Clean up coding
style.
(haiku_set_z_group): New function.
(haiku_create_frame): Always set z group after window creation,
like on X.
(haiku_frame_parm_handlers): Add `haiku_set_z_group'.
uint32 pre_override_redirect_workspaces;
int window_id;
bool *menus_begun = NULL;
+ enum haiku_z_group z_group;
EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
{
window_id = current_window_id++;
+ z_group = Z_GROUP_NONE;
/* This pulse rate is used by scroll bars for repeating a button
action while a button is held down. */
child_frame_lock.Unlock ();
}
+ void
+ RecomputeFeel (void)
+ {
+ if (override_redirect_p)
+ SetFeel (kMenuWindowFeel);
+ else if (parent)
+ SetFeel (B_FLOATING_SUBSET_WINDOW_FEEL);
+ else if (z_group == Z_GROUP_ABOVE)
+ SetFeel (B_FLOATING_ALL_WINDOW_FEEL);
+ else
+ SetFeel (B_NORMAL_WINDOW_FEEL);
+ }
+
BRect
CalculateZoomRect (void)
{
void
Unparent (void)
{
+ EmacsWindow *parent;
+
if (!child_frame_lock.Lock ())
gui_abort ("Failed to lock child frame state lock");
- this->SetFeel (B_NORMAL_WINDOW_FEEL);
+
+ parent = this->parent;
+ this->parent = NULL;
+ RecomputeFeel ();
UpwardsUnSubsetChildren (parent);
this->RemoveFromSubset (this);
- this->parent = NULL;
+
if (fullscreen_p)
{
fullscreen_p = 0;
UnparentAndUnlink ();
this->parent = window;
- this->SetFeel (B_FLOATING_SUBSET_WINDOW_FEEL);
+ RecomputeFeel ();
this->AddToSubset (this);
if (!IsHidden () && this->parent)
UpwardsSubsetChildren (parent);
if (override_redirect_p && !w->override_redirect_p)
{
w->override_redirect_p = true;
- w->pre_override_redirect_feel = w->Feel ();
w->pre_override_redirect_look = w->Look ();
- w->SetFeel (kMenuWindowFeel);
+ w->RecomputeFeel ();
w->SetLook (B_NO_BORDER_WINDOW_LOOK);
w->pre_override_redirect_workspaces = w->Workspaces ();
w->SetWorkspaces (B_ALL_WORKSPACES);
else if (w->override_redirect_p)
{
w->override_redirect_p = false;
- w->SetFeel (w->pre_override_redirect_feel);
w->SetLook (w->pre_override_redirect_look);
+ w->RecomputeFeel ();
w->SetWorkspaces (w->pre_override_redirect_workspaces);
}
messenger.SendMessage (&msg, &reply);
return reply.what == BE_MENU_BAR_OPEN;
}
+
+void
+BWindow_set_z_group (void *window, enum haiku_z_group z_group)
+{
+ EmacsWindow *w = (EmacsWindow *) window;
+
+ if (w->LockLooper ())
+ {
+ if (w->z_group != z_group)
+ {
+ w->z_group = z_group;
+ w->RecomputeFeel ();
+ }
+
+ w->UnlockLooper ();
+ }
+}
enum haiku_cursor
{
- CURSOR_ID_NO_CURSOR = 12,
- CURSOR_ID_RESIZE_NORTH = 15,
- CURSOR_ID_RESIZE_EAST = 16,
- CURSOR_ID_RESIZE_SOUTH = 17,
- CURSOR_ID_RESIZE_WEST = 18,
- CURSOR_ID_RESIZE_NORTH_EAST = 19,
- CURSOR_ID_RESIZE_NORTH_WEST = 20,
- CURSOR_ID_RESIZE_SOUTH_EAST = 21,
- CURSOR_ID_RESIZE_SOUTH_WEST = 22,
- CURSOR_ID_RESIZE_NORTH_SOUTH = 23,
- CURSOR_ID_RESIZE_EAST_WEST = 24,
+ CURSOR_ID_NO_CURSOR = 12,
+ CURSOR_ID_RESIZE_NORTH = 15,
+ CURSOR_ID_RESIZE_EAST = 16,
+ CURSOR_ID_RESIZE_SOUTH = 17,
+ CURSOR_ID_RESIZE_WEST = 18,
+ CURSOR_ID_RESIZE_NORTH_EAST = 19,
+ CURSOR_ID_RESIZE_NORTH_WEST = 20,
+ CURSOR_ID_RESIZE_SOUTH_EAST = 21,
+ CURSOR_ID_RESIZE_SOUTH_WEST = 22,
+ CURSOR_ID_RESIZE_NORTH_SOUTH = 23,
+ CURSOR_ID_RESIZE_EAST_WEST = 24,
CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST = 25,
CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST = 26
};
+enum haiku_z_group
+ {
+ Z_GROUP_ABOVE,
+ Z_GROUP_NONE,
+ Z_GROUP_BELOW,
+ };
+
enum haiku_alert_type
{
HAIKU_EMPTY_ALERT = 0,
extern bool BWindow_is_active (void *);
extern void BWindow_set_override_redirect (void *, bool);
extern void BWindow_dimensions (void *, int *, int *);
+extern void BWindow_set_z_group (void *, enum haiku_z_group);
extern void BWindow_Flush (void *);
extern void BFont_close (void *);
}
static void
-haiku_set_parent_frame (struct frame *f,
- Lisp_Object new_value, Lisp_Object old_value)
+haiku_set_parent_frame (struct frame *f, Lisp_Object new_value,
+ Lisp_Object old_value)
{
struct frame *p = NULL;
block_input ();
EmacsWindow_unparent (FRAME_HAIKU_WINDOW (f));
FRAME_OUTPUT_DATA (f)->parent_desc = NULL;
}
+
if (!NILP (new_value))
{
EmacsWindow_parent_to (FRAME_HAIKU_WINDOW (f),
unblock_input ();
}
+static void
+haiku_set_z_group (struct frame *f, Lisp_Object new_value,
+ Lisp_Object old_value)
+{
+ int rc;
+
+ /* Tooltip frames can't have Z groups, since the window feel is
+ overridden during frame creation. */
+ if (FRAME_TOOLTIP_P (f))
+ return;
+
+ rc = 1;
+ block_input ();
+
+ if (NILP (new_value))
+ {
+ BWindow_set_z_group (FRAME_HAIKU_WINDOW (f), Z_GROUP_NONE);
+ FRAME_Z_GROUP (f) = z_group_none;
+ }
+ else if (EQ (new_value, Qabove))
+ {
+ BWindow_set_z_group (FRAME_HAIKU_WINDOW (f), Z_GROUP_ABOVE);
+ FRAME_Z_GROUP (f) = z_group_above;
+ }
+ else if (EQ (new_value, Qbelow))
+ {
+ BWindow_set_z_group (FRAME_HAIKU_WINDOW (f), Z_GROUP_BELOW);
+ FRAME_Z_GROUP (f) = z_group_below;
+ }
+ else
+ rc = 0;
+
+ unblock_input ();
+ if (!rc)
+ error ("Invalid z-group specification");
+}
+
static void
haiku_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
RES_TYPE_NUMBER);
if (FIXNUMP (tem))
store_frame_param (f, Qmin_height, tem);
+
adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1,
Qx_create_frame_1);
- gui_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL);
gui_default_parameter (f, parms, Qno_focus_on_map, Qnil,
NULL, NULL, RES_TYPE_BOOLEAN);
gui_default_parameter (f, parms, Qno_accept_focus, Qnil,
|| !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
kset_default_minibuffer_frame (kb, frame);
+ gui_default_parameter (f, parms, Qz_group, Qnil,
+ NULL, NULL, RES_TYPE_SYMBOL);
+
for (tem = parms; CONSP (tem); tem = XCDR (tem))
if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
NULL, /* set skip taskbar */
haiku_set_no_focus_on_map,
haiku_set_no_accept_focus,
- NULL, /* set z group */
+ haiku_set_z_group,
haiku_set_override_redirect,
gui_set_no_special_glyphs,
gui_set_alpha_background,