emacs_abort ();
}
-#ifdef USE_BE_CAIRO
-static cairo_format_t
-cairo_format_from_color_space (color_space space)
-{
- switch (space)
- {
- case B_RGBA32:
- return CAIRO_FORMAT_ARGB32;
- case B_RGB32:
- return CAIRO_FORMAT_RGB24;
- case B_RGB16:
- return CAIRO_FORMAT_RGB16_565;
- case B_GRAY8:
- return CAIRO_FORMAT_A8;
- case B_GRAY1:
- return CAIRO_FORMAT_A1;
- default:
- gui_abort ("Unsupported color space");
- }
-}
-#endif
-
static void
map_key (char *chars, int32 offset, uint32_t *c)
{
}
};
-class EmacsWindow : public BDirectWindow
+class EmacsWindow : public BWindow
{
public:
struct child_frame
int zoomed_p = 0;
int shown_flag = 0;
-#ifdef USE_BE_CAIRO
- BLocker surface_lock;
- cairo_surface_t *cr_surface = NULL;
-#endif
-
- EmacsWindow () : BDirectWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK,
- B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
+ EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK,
+ B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
{
}
if (this->parent)
UnparentAndUnlink ();
-
-#ifdef USE_BE_CAIRO
- if (!surface_lock.Lock ())
- gui_abort ("Failed to lock cairo surface");
- if (cr_surface)
- {
- cairo_surface_destroy (cr_surface);
- cr_surface = NULL;
- }
- surface_lock.Unlock ();
-#endif
}
void
haiku_write (ACTIVATION, &rq);
}
- void
- DirectConnected (direct_buffer_info *info)
- {
-#ifdef USE_BE_CAIRO
- if (!surface_lock.Lock ())
- gui_abort ("Failed to lock window direct cr surface");
- if (cr_surface)
- {
- cairo_surface_destroy (cr_surface);
- cr_surface = NULL;
- }
-
- if (info->buffer_state != B_DIRECT_STOP)
- {
- int left, top, right, bottom;
- left = info->clip_bounds.left;
- top = info->clip_bounds.top;
- right = info->clip_bounds.right;
- bottom = info->clip_bounds.bottom;
-
- unsigned char *bits = (unsigned char *) info->bits;
- if ((info->bits_per_pixel % 8) == 0)
- {
- bits += info->bytes_per_row * top;
- bits += (left * info->bits_per_pixel / 8);
- cr_surface = cairo_image_surface_create_for_data
- (bits,
- cairo_format_from_color_space (info->pixel_format),
- right - left + 1,
- bottom - top + 1,
- info->bytes_per_row);
- }
- }
- surface_lock.Unlock ();
-#endif
- }
-
void
MessageReceived (BMessage *msg)
{
haiku_write (FILE_PANEL_EVENT, &rq);
}
else
- BDirectWindow::MessageReceived (msg);
+ BWindow::MessageReceived (msg);
}
void
};
}
else
- BDirectWindow::DispatchMessage (msg, handler);
+ BWindow::DispatchMessage (msg, handler);
}
void
rq.px_widthf = newWidth + 1.0f;
haiku_write (FRAME_RESIZED, &rq);
- BDirectWindow::FrameResized (newWidth, newHeight);
+ BWindow::FrameResized (newWidth, newHeight);
}
void
for (struct child_frame *f = subset_windows;
f; f = f->next)
DoMove (f);
- BDirectWindow::FrameMoved (newPosition);
+ BWindow::FrameMoved (newPosition);
}
void
void
Minimize (bool minimized_p)
{
- BDirectWindow::Minimize (minimized_p);
+ BWindow::Minimize (minimized_p);
struct haiku_iconification_event rq;
rq.window = this;
rq.iconified_p = !parent && minimized_p;
x_before_zoom = y_before_zoom = INT_MIN;
}
- BDirectWindow::Zoom (o, w, h);
+ BWindow::Zoom (o, w, h);
}
void
EmacsView_cairo_surface (void *view)
{
EmacsView *vw = (EmacsView *) view;
- EmacsWindow *wn = (EmacsWindow *) vw->Window ();
- return vw->cr_surface ? vw->cr_surface : wn->cr_surface;
+ return vw->cr_surface;
}
/* Transfer each clip rectangle in VIEW to the cairo context
void
EmacsWindow_begin_cr_critical_section (void *window)
{
- EmacsWindow *w = (EmacsWindow *) window;
- if (!w->surface_lock.Lock ())
- gui_abort ("Couldn't lock cairo surface");
-
+ BWindow *w = (BWindow *) window;
BView *vw = (BView *) w->FindView ("Emacs");
EmacsView *ev = dynamic_cast <EmacsView *> (vw);
if (ev && !ev->cr_surface_lock.Lock ())
void
EmacsWindow_end_cr_critical_section (void *window)
{
- EmacsWindow *w = (EmacsWindow *) window;
- w->surface_lock.Unlock ();
+ BWindow *w = (BWindow *) window;
BView *vw = (BView *) w->FindView ("Emacs");
EmacsView *ev = dynamic_cast <EmacsView *> (vw);
if (ev)