Skip to content

Commit

Permalink
* shoes/native/windows.c: okay, this seems to work much better for b…
Browse files Browse the repository at this point in the history
…ackground repaints on xp. i need to revisit this code again after some serious reflection. the deal is: when a window is painted in the background, the BeginPaint call gets a clipped device context. for some reason, this context either doesn't jive with cairo or it does not like my double-buffering code. only a fragment of the clipped rectangle ends up painting. for now, i'm going to repaint the whole window, just to get it working. it's got decent speed and this whole problem goes away in vista, so.

 * shoes/ruby.c: on EditBox.text= and EditLine.text=, convert newlines.
  • Loading branch information
_why committed Jun 25, 2008
1 parent c21f899 commit e2a33f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
20 changes: 17 additions & 3 deletions shoes/native/windows.c
Expand Up @@ -858,7 +858,10 @@ shoes_cairo_create(shoes_canvas *canvas)
return NULL;

HBITMAP bitmap, bitold;
canvas->slot.dc2 = BeginPaint(canvas->slot.window, &canvas->slot.ps);
if (DC(canvas->slot) != DC(canvas->app->slot))
canvas->slot.dc2 = BeginPaint(canvas->slot.window, &canvas->slot.ps);
else
canvas->slot.dc2 = GetDC(canvas->slot.window);
if (canvas->slot.dc != NULL)
{
DeleteObject(GetCurrentObject(canvas->slot.dc, OBJ_BITMAP));
Expand All @@ -868,7 +871,15 @@ shoes_cairo_create(shoes_canvas *canvas)
bitmap = CreateCompatibleBitmap(canvas->slot.dc2, canvas->width, canvas->height);
bitold = (HBITMAP)SelectObject(canvas->slot.dc, bitmap);
DeleteObject(bitold);
if (DC(canvas->slot) != DC(canvas->app->slot))
if (DC(canvas->slot) == DC(canvas->app->slot))
{
RECT rc;
HBRUSH bg = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
GetClientRect(canvas->slot.window, &rc);
FillRect(canvas->slot.dc, &rc, bg);
DeleteObject(bg);
}
else
{
shoes_canvas *parent;
Data_Get_Struct(canvas->parent, shoes_canvas, parent);
Expand All @@ -894,7 +905,10 @@ void shoes_cairo_destroy(shoes_canvas *canvas)
BitBlt(canvas->slot.dc2, 0, 0, canvas->width, canvas->height, canvas->slot.dc, 0, 0, SRCCOPY);
cairo_surface_destroy(canvas->slot.surface);
canvas->slot.surface = NULL;
EndPaint(canvas->slot.window, &canvas->slot.ps);
if (DC(canvas->slot) != DC(canvas->app->slot))
EndPaint(canvas->slot.window, &canvas->slot.ps);
else
ReleaseDC(canvas->slot.window, canvas->slot.dc2);
}

void
Expand Down
12 changes: 10 additions & 2 deletions shoes/ruby.c
Expand Up @@ -2867,7 +2867,11 @@ shoes_edit_line_set_text(VALUE self, VALUE text)
{
char *msg = "";
GET_STRUCT(control, self_t);
if (!NIL_P(text)) msg = RSTRING_PTR(text);
if (!NIL_P(text))
{
text = shoes_native_to_s(text);
msg = RSTRING_PTR(text);
}
shoes_native_edit_line_set_text(self_t->ref, msg);
return text;
}
Expand Down Expand Up @@ -2910,7 +2914,11 @@ shoes_edit_box_set_text(VALUE self, VALUE text)
{
char *msg = "";
GET_STRUCT(control, self_t);
if (!NIL_P(text)) msg = RSTRING_PTR(text);
if (!NIL_P(text))
{
text = shoes_native_to_s(text);
msg = RSTRING_PTR(text);
}
shoes_native_edit_box_set_text(self_t->ref, msg);
return text;
}
Expand Down

0 comments on commit e2a33f5

Please sign in to comment.