aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c4
-rw-r--r--src/xwidget.c45
2 files changed, 39 insertions, 10 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 41d7ffd73fc..2fb813d04fc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2595,7 +2595,9 @@ x_draw_glyph_string (struct glyph_string *s)
2595 break; 2595 break;
2596 2596
2597 case XWIDGET_GLYPH: 2597 case XWIDGET_GLYPH:
2598 //x_draw_glyph_string_background (s, 0); 2598 //erase xwidget background
2599 x_draw_glyph_string_background (s, 0);
2600 //x_draw_xwidget_glyph_string draws phantom xwidgets only, live xwidgets are drawn in an expose handler
2599 x_draw_xwidget_glyph_string (s); 2601 x_draw_xwidget_glyph_string (s);
2600 break; 2602 break;
2601 2603
diff --git a/src/xwidget.c b/src/xwidget.c
index e63e5d6ddf7..e4f1cedad60 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -205,7 +205,11 @@ xwidget_composite_draw_2(GtkWidget *widget,
205 cr = gdk_cairo_create (gtk_widget_get_window (phantom ? f->gwfixed : xw->widgetwindow));//GTK_WIDGET(xw->emacswindow));//));//widget->window); 205 cr = gdk_cairo_create (gtk_widget_get_window (phantom ? f->gwfixed : xw->widgetwindow));//GTK_WIDGET(xw->emacswindow));//));//widget->window);
206 /* the source data is the (composited) xwidget */ 206 /* the source data is the (composited) xwidget */
207 //cairo_move_to(cr, xw->x, xw->y); 207 //cairo_move_to(cr, xw->x, xw->y);
208
208 if(phantom){ 209 if(phantom){
210 cairo_rectangle(cr, x,y, xw->width, xw->height);
211 cairo_clip(cr);
212
209 cairo_set_source_rgb(cr,1.0,0,0); 213 cairo_set_source_rgb(cr,1.0,0,0);
210 cairo_rectangle(cr,x,y,xw->width,xw->height); 214 cairo_rectangle(cr,x,y,xw->width,xw->height);
211 cairo_fill(cr); 215 cairo_fill(cr);
@@ -229,6 +233,7 @@ xwidget_composite_draw_2(GtkWidget *widget,
229 return FALSE; 233 return FALSE;
230} 234}
231 235
236/*
232static gboolean 237static gboolean
233xwidget_composite_draw(GtkWidget *widget, 238xwidget_composite_draw(GtkWidget *widget,
234 GdkEventExpose *event, 239 GdkEventExpose *event,
@@ -242,6 +247,15 @@ xwidget_composite_draw(GtkWidget *widget,
242 xw->x, xw->y, 0); 247 xw->x, xw->y, 0);
243 return FALSE; 248 return FALSE;
244} 249}
250*/
251
252
253void xwidget_plug_added(GtkSocket *socket,
254 gpointer user_data)
255{
256 //hmm this doesnt seem to get called for foreign windows
257 printf("xwidget_plug_added\n");
258}
245 259
246static gboolean 260static gboolean
247xwidget_composite_draw_widgetwindow(GtkWidget *widget, 261xwidget_composite_draw_widgetwindow(GtkWidget *widget,
@@ -250,11 +264,17 @@ xwidget_composite_draw_widgetwindow(GtkWidget *widget,
250{ 264{
251 struct xwidget* xw = (struct xwidget*) g_object_get_data (G_OBJECT (widget), XG_XWIDGET); 265 struct xwidget* xw = (struct xwidget*) g_object_get_data (G_OBJECT (widget), XG_XWIDGET);
252 cairo_t *cr; 266 cairo_t *cr;
267 GdkPixmap *pixmap;
268 pixmap=xw->widget->window;
269
253 cr = gdk_cairo_create (gtk_widget_get_window (widget)); 270 cr = gdk_cairo_create (gtk_widget_get_window (widget));
271 cairo_rectangle(cr, 0,0, xw->width, xw->height);
272 cairo_clip(cr);
273
254 cairo_set_source_rgb(cr,0,1.0,0); 274 cairo_set_source_rgb(cr,0,1.0,0);
255 cairo_rectangle(cr, 0,0, xw->width, xw->height); 275 cairo_rectangle(cr, 0,0, xw->width, xw->height);
256 cairo_fill(cr); 276 cairo_fill(cr);
257 gdk_cairo_set_source_pixmap (cr, xw->widget->window, 277 gdk_cairo_set_source_pixmap (cr, pixmap,
258 0,0); 278 0,0);
259 279
260 cairo_set_operator (cr, CAIRO_OPERATOR_OVER); 280 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
@@ -273,7 +293,7 @@ xwidget_init (struct xwidget *xw, struct glyph_string *s, int x, int y)
273 xwidget_show(xw); 293 xwidget_show(xw);
274 294
275 //widget creation 295 //widget creation
276 switch (xw->type) 296 switch (xw->type)
277 { 297 {
278 case 1: 298 case 1:
279 xw->widget = gtk_button_new_with_label (xw->title); 299 xw->widget = gtk_button_new_with_label (xw->title);
@@ -285,6 +305,11 @@ xwidget_init (struct xwidget *xw, struct glyph_string *s, int x, int y)
285 break; 305 break;
286 case 3: 306 case 3:
287 xw->widget = gtk_socket_new (); 307 xw->widget = gtk_socket_new ();
308 //gtk_widget_set_app_paintable (xw->widget, TRUE); //workaround for composited sockets
309 GdkColor color;
310 gdk_color_parse("blue",&color); //the blue color never seems to show up. something else draw the bg
311 gtk_widget_modify_bg(xw->widget, GTK_STATE_NORMAL, &color);
312 g_signal_connect_after(xw->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added");
288 break; 313 break;
289 case 4: 314 case 4:
290 xw->widget = 315 xw->widget =
@@ -313,7 +338,8 @@ xwidget_init (struct xwidget *xw, struct glyph_string *s, int x, int y)
313 338
314 //this seems to enable xcomposition. later we need to paint ourselves somehow, 339 //this seems to enable xcomposition. later we need to paint ourselves somehow,
315 //since the widget is no longer responsible for painting itself 340 //since the widget is no longer responsible for painting itself
316 gdk_window_set_composited (xw->widget->window, TRUE); 341 if(xw->type!=3) //im having trouble with compositing and sockets. hmmm.
342 gdk_window_set_composited (xw->widget->window, TRUE);
317 //gdk_window_set_composited (xw->widgetwindow, TRUE); 343 //gdk_window_set_composited (xw->widgetwindow, TRUE);
318 //g_signal_connect_after(xw->widget, "expose-event", G_CALLBACK(xwidget_composite_draw), "widget exposed"); 344 //g_signal_connect_after(xw->widget, "expose-event", G_CALLBACK(xwidget_composite_draw), "widget exposed");
319 g_signal_connect_after(xw->widgetwindow, "expose-event", G_CALLBACK(xwidget_composite_draw_widgetwindow), "widgetwindow exposed"); 345 g_signal_connect_after(xw->widgetwindow, "expose-event", G_CALLBACK(xwidget_composite_draw_widgetwindow), "widgetwindow exposed");
@@ -438,10 +464,10 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
438 struct xwidget *xw = &xwidgets[s->xwidget_id]; 464 struct xwidget *xw = &xwidgets[s->xwidget_id];
439 int clipx; int clipy; 465 int clipx; int clipy;
440 466
441 printf("x_draw_xwidget_glyph_string: id:%d %d %d (%d,%d,%d,%d) selected win:%d\n", 467 /*printf("x_draw_xwidget_glyph_string: id:%d %d %d (%d,%d,%d,%d) selected win:%d\n",
442 s->xwidget_id, box_line_hwidth, box_line_vwidth, 468 s->xwidget_id, box_line_hwidth, box_line_vwidth,
443 s->x, s->y, s->height, s->width, 469 s->x, s->y, s->height, s->width,
444 drawing_in_selected_window); 470 drawing_in_selected_window);*/
445 471
446 int x = s->x; 472 int x = s->x;
447 int y = s->y + (s->height / 2) - (xw->height / 2); 473 int y = s->y + (s->height / 2) - (xw->height / 2);
@@ -480,8 +506,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
480 506
481 //if we are using compositing, we are always responsible for drawing the widget on the screen 507 //if we are using compositing, we are always responsible for drawing the widget on the screen
482 //just reuse the phantom routine for now 508 //just reuse the phantom routine for now
483 printf("draw live xwidget at:%d %d\n",x,y); 509 //printf("draw live xwidget at:%d %d\n",x,y);
484 xwidget_draw_phantom (xw, x, y, clipx, clipy, s, 1); 510 //xwidget_draw_phantom (xw, x, y, clipx, clipy, s, 1);
485 } 511 }
486 else 512 else
487 { 513 {
@@ -498,7 +524,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
498 else 524 else
499 { 525 {
500 //ok, we are painting the xwidgets in non-selected window, so draw a phantom 526 //ok, we are painting the xwidgets in non-selected window, so draw a phantom
501 printf("draw phantom xwidget at:%d %d\n",x,y); 527 //printf("draw phantom xwidget at:%d %d\n",x,y);
502 528
503 xwidget_draw_phantom (xw, x, y, clipx, clipy, s, 1); 529 xwidget_draw_phantom (xw, x, y, clipx, clipy, s, 1);
504 530
@@ -509,7 +535,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
509 535
510 536
511 537
512DEFUN ("xwidget-embed-steal-window", Fxwidget_embed_steal_window, Sxwidget_embed_steal_window, 2, 2, 0, doc: /* tell existing embed xwidget to steal other window id. */ 538DEFUN ("xwidget-embed-steal-window", Fxwidget_embed_steal_window, Sxwidget_embed_steal_window, 2, 2, 0,
539 doc: /* Tell existing embed xwidget to steal other window id. This is based on a deprecated method in GTK and doesnt work too well.*/
513 ) 540 )
514 (Lisp_Object xwidget_id, Lisp_Object window_id) 541 (Lisp_Object xwidget_id, Lisp_Object window_id)
515{ 542{