Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
c8937ab9
Commit
c8937ab9
authored
Jul 30, 2011
by
Joakim Verona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ifdef guarding of xwidget code. not complete
parent
e9a96749
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
100 additions
and
533 deletions
+100
-533
src/dispextern.h
src/dispextern.h
+14
-4
src/dispnew.c
src/dispnew.c
+2
-2
src/emacs.c
src/emacs.c
+4
-0
src/emacsgtkfixed.c
src/emacsgtkfixed.c
+6
-1
src/insdel.c
src/insdel.c
+0
-1
src/keyboard.c
src/keyboard.c
+14
-4
src/lisp.h
src/lisp.h
+2
-0
src/print.c
src/print.c
+4
-1
src/termhooks.h
src/termhooks.h
+3
-2
src/window.c
src/window.c
+4
-1
src/xdisp.c
src/xdisp.c
+41
-16
src/xterm.c
src/xterm.c
+6
-2
src/xwidget-attic.c
src/xwidget-attic.c
+0
-499
No files found.
src/dispextern.h
View file @
c8937ab9
...
...
@@ -291,9 +291,10 @@ enum glyph_type
/* Glyph is a space of fractional width and/or height. */
STRETCH_GLYPH
,
#ifdef HAVE_XWIDGETS
/* Glyph is an external widget drawn by the GUI toolkit. */
XWIDGET_GLYPH
#endif
};
...
...
@@ -436,7 +437,9 @@ struct glyph
/* Image ID for image glyphs (type == IMAGE_GLYPH). */
int
img_id
;
#ifdef HAVE_XWIDGETS
struct
xwidget
*
xwidget
;
#endif
/* Sub-structure for type == STRETCH_GLYPH. */
struct
{
...
...
@@ -1303,8 +1306,9 @@ struct glyph_string
/* Image, if any. */
struct
image
*
img
;
#ifdef HAVE_XWIDGETS
struct
xwidget
*
xwidget
;
#endif
/* Slice */
struct
glyph_slice
slice
;
...
...
@@ -1987,7 +1991,9 @@ enum display_element_type
/* Continuation glyphs. See the comment for IT_TRUNCATION. */
IT_CONTINUATION
,
#ifdef HAVE_XWIDGETS
IT_XWIDGET
#endif
};
...
...
@@ -2051,7 +2057,9 @@ enum it_method {
GET_FROM_C_STRING
,
GET_FROM_IMAGE
,
GET_FROM_STRETCH
,
#ifdef HAVE_XWIDGETS
GET_FROM_XWIDGET
,
#endif
NUM_IT_METHODS
};
...
...
@@ -2265,12 +2273,13 @@ struct it
struct
{
Lisp_Object
object
;
}
stretch
;
#ifdef HAVE_XWIDGETS
/* method == GET_FROM_XWIDGET */
struct
{
Lisp_Object
object
;
struct
xwidget
*
xwidget
;
}
xwidget
;
#endif
}
u
;
/* current text and display positions. */
...
...
@@ -2393,9 +2402,10 @@ struct it
/* If what == IT_IMAGE, the id of the image to display. */
int
image_id
;
#ifdef HAVE_XWIDGETS
/* If what == IT_XWIDGET*/
struct
xwidget
*
xwidget
;
#endif
/* Values from `slice' property. */
struct
it_slice
slice
;
...
...
src/dispnew.c
View file @
c8937ab9
...
...
@@ -3702,9 +3702,9 @@ update_window (struct window *w, int force_p)
add_window_display_history
(
w
,
w
->
current_matrix
->
method
,
paused_p
);
#endif
// if ((XWINDOW(FRAME_SELECTED_WINDOW (SELECTED_FRAME()))) == (w))
#ifdef HAVE_XWIDGETS
xwidget_end_redisplay
(
w
,
w
->
current_matrix
);
#endif
clear_glyph_matrix
(
desired_matrix
);
return
paused_p
;
...
...
src/emacs.c
View file @
c8937ab9
...
...
@@ -48,7 +48,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "buffer.h"
#include "window.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
#include "systty.h"
#include "blockinput.h"
#include "syssignal.h"
...
...
@@ -1529,7 +1531,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_xfns
();
syms_of_xmenu
();
syms_of_fontset
();
#ifdef HAVE_XWIDGETS
syms_of_xwidget
();
#endif
syms_of_xsettings
();
#ifdef HAVE_X_SM
syms_of_xsmfns
();
...
...
src/emacsgtkfixed.c
View file @
c8937ab9
...
...
@@ -27,7 +27,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
#include "frame.h"
#include "xterm.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
struct
_EmacsFixedPrivate
{
struct
frame
*
f
;
...
...
@@ -42,6 +44,7 @@ static void emacs_fixed_get_preferred_height (GtkWidget *widget,
gint
*
natural
);
G_DEFINE_TYPE
(
EmacsFixed
,
emacs_fixed
,
GTK_TYPE_FIXED
)
#ifdef HAVE_XWIDGETS
/* void aloc_callback(GtkWidget* child, GtkWidget* fixed){ */
/* GtkAllocation child_allocation; */
/* GtkRequisition child_requisition; */
...
...
@@ -154,7 +157,7 @@ static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
}
#endif
static
void
emacs_fixed_class_init
(
EmacsFixedClass
*
klass
)
...
...
@@ -167,7 +170,9 @@ emacs_fixed_class_init (EmacsFixedClass *klass)
widget_class
->
get_preferred_width
=
emacs_fixed_get_preferred_width
;
widget_class
->
get_preferred_height
=
emacs_fixed_get_preferred_height
;
#ifdef HAVE_XWIDGETS
widget_class
->
size_allocate
=
emacs_fixed_gtk_widget_size_allocate
;
#endif
g_type_class_add_private
(
klass
,
sizeof
(
EmacsFixedPrivate
));
}
...
...
src/insdel.c
View file @
c8937ab9
...
...
@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "window.h"
#include "blockinput.h"
#include "region-cache.h"
#include "xwidget.h"
#ifndef NULL
#define NULL 0
...
...
src/keyboard.c
View file @
c8937ab9
...
...
@@ -329,7 +329,9 @@ static Lisp_Object Qsave_session;
#ifdef HAVE_DBUS
static Lisp_Object Qdbus_event;
#endif
#ifdef HAVE_XWIDGETS
Lisp_Object Qxwidget_event;
#endif
static Lisp_Object Qconfig_changed_event;
/* Lisp_Object Qmouse_movement; - also an event header */
...
...
@@ -4029,7 +4031,14 @@ kbd_buffer_get_event (KBOARD **kbp,
kbd_fetch_ptr = event + 1;
}
#endif
else if (event->kind == CONFIG_CHANGED_EVENT || event->kind == XWIDGET_EVENT)
#ifdef HAVE_XWIDGETS
else if (event->kind == XWIDGET_EVENT)
{
obj = make_lispy_event (event);
kbd_fetch_ptr = event + 1;
}
#endif
else if (event->kind == CONFIG_CHANGED_EVENT)
{
obj = make_lispy_event (event);
kbd_fetch_ptr = event + 1;
...
...
@@ -5924,12 +5933,13 @@ make_lispy_event (struct input_event *event)
return Fcons (Qdbus_event, event->arg);
}
#endif /* HAVE_DBUS */
#ifdef HAVE_XWIDGETS
case XWIDGET_EVENT:
{
printf("cool, an xwidget event arrived in make_lispy_event!\n");
return Fcons (Qxwidget_event,event->arg);
}
#endif
case CONFIG_CHANGED_EVENT:
return Fcons (Qconfig_changed_event,
Fcons (event->arg,
...
...
@@ -11542,10 +11552,10 @@ syms_of_keyboard (void)
DEFSYM (Qdbus_event, "dbus-event");
#endif
#ifdef HAVE_XWIDGETS
Qxwidget_event = intern ("xwidget-event");
staticpro (&Qxwidget_event);
#endif
DEFSYM (QCenable, ":enable");
DEFSYM (QCvisible, ":visible");
DEFSYM (QChelp, ":help");
...
...
src/lisp.h
View file @
c8937ab9
...
...
@@ -405,8 +405,10 @@ enum pvec_type
PVEC_SUB_CHAR_TABLE
=
0x100000
,
PVEC_FONT
=
0x200000
,
PVEC_OTHER
=
0x400000
,
#ifdef HAVE_XWIDGETS
PVEC_XWIDGET
=
0x800000
,
PVEC_XWIDGET_VIEW
=
0x1000000
,
#endif
PVEC_TYPE_MASK
=
0x3fffe00
#if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
...
...
src/print.c
View file @
c8937ab9
...
...
@@ -36,8 +36,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "blockinput.h"
#include "termhooks.h"
/* For struct terminal. */
#include "font.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
Lisp_Object
Qstandard_output
;
static
Lisp_Object
Qtemp_buffer_setup_hook
;
...
...
@@ -1759,11 +1760,13 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
strout
(
XSUBR
(
obj
)
->
symbol_name
,
-
1
,
-
1
,
printcharfun
);
PRINTCHAR
(
'>'
);
}
#ifdef HAVE_XWIDGETS
else
if
(
XXWIDGETP
(
obj
))
{
strout
(
"#<xwidget "
,
-
1
,
-
1
,
printcharfun
);
PRINTCHAR
(
'>'
);
}
#endif
else
if
(
WINDOWP
(
obj
))
{
strout
(
"#<window "
,
-
1
,
-
1
,
printcharfun
);
...
...
src/termhooks.h
View file @
c8937ab9
...
...
@@ -205,9 +205,10 @@ enum event_kind
/* Non-key system events (e.g. application menu events) */
,
NS_NONKEY_EVENT
#endif
/* events generated by xwidgets*/
#ifdef HAVE_XWIDGETS
/* events generated by xwidgets*/
,
XWIDGET_EVENT
#endif
};
/* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
...
...
src/window.c
View file @
c8937ab9
...
...
@@ -49,8 +49,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_NS
#include "nsterm.h"
#endif
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
Lisp_Object
Qwindowp
,
Qwindow_live_p
;
static
Lisp_Object
Qwindow_configuration_p
,
Qrecord_window_buffer
;
static
Lisp_Object
Qwindow_deletable_p
,
Qdelete_window
,
Qdisplay_buffer
;
...
...
@@ -3934,7 +3935,9 @@ when WINDOW is the only window on its frame. */)
{
/* Block input. */
BLOCK_INPUT
;
#ifdef HAVE_XWIDGETS
xwidget_view_delete_all_in_window
(
w
);
#endif
window_resize_apply
(
p
,
horflag
);
windows_or_buffers_changed
++
;
...
...
src/xdisp.c
View file @
c8937ab9
...
...
@@ -313,8 +313,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#include "font.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
#ifndef FRAME_X_OUTPUT
#define FRAME_X_OUTPUT(f) ((f)->output_data.x)
#endif
...
...
@@ -884,7 +885,9 @@ static int next_element_from_c_string (struct it *);
static int next_element_from_buffer (struct it *);
static int next_element_from_composition (struct it *);
static int next_element_from_image (struct it *);
#ifdef HAVE_XWIDGETS
static int next_element_from_xwidget(struct it *);
#endif
static int next_element_from_stretch (struct it *);
static void load_overlay_strings (struct it *, EMACS_INT);
static int init_from_display_pos (struct it *, struct window *,
...
...
@@ -4129,7 +4132,9 @@ handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
if (CONSP (spec)
/* Simple specerties. */
&& !EQ (XCAR (spec), Qimage)
#ifdef HAVE_XWIDGETS
&& !EQ (XCAR (spec), Qxwidget)
#endif
&& !EQ (XCAR (spec), Qspace)
&& !EQ (XCAR (spec), Qwhen)
&& !EQ (XCAR (spec), Qslice)
...
...
@@ -4548,7 +4553,10 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
&& valid_image_p (value))
#endif /* not HAVE_WINDOW_SYSTEM */
|| (CONSP (value) && EQ (XCAR (value), Qspace))
|| XWIDGETP(value));
#ifdef HAVE_XWIDGETS
|| XWIDGETP(value)
#endif
);
if (valid_p && !display_replaced_p)
{
...
...
@@ -4612,6 +4620,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
it->object = value;
*position = it->position = start_pos;
}
#ifdef HAVE_XWIDGETS
else if (XWIDGETP(value))
{
//printf("handle_single_display_spec: im an xwidget!!\n");
...
...
@@ -4623,8 +4632,9 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
it->xwidget = lookup_xwidget(value);
}
#endif
#ifdef HAVE_WINDOW_SYSTEM
else
//if nothing else, its an image
else
{
it->what = IT_IMAGE;
it->image_id = lookup_image (it->f, value);
...
...
@@ -5338,9 +5348,11 @@ push_it (struct it *it, struct text_pos *position)
case GET_FROM_STRETCH:
p->u.stretch.object = it->object;
break;
#ifdef HAVE_XWIDGETS
case GET_FROM_XWIDGET:
p->u.xwidget.object = it->object;
break;
#endif
}
p->position = position ? *position : it->position;
p->current = it->current;
...
...
@@ -5433,9 +5445,11 @@ pop_it (struct it *it)
it->object = p->u.image.object;
it->slice = p->u.image.slice;
break;
#ifdef HAVE_XWIDGETS
case GET_FROM_XWIDGET:
it->object = p->u.xwidget.object;
break;
#endif
case GET_FROM_STRETCH:
it->object = p->u.stretch.object;
break;
...
...
@@ -6031,8 +6045,10 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) =
next_element_from_string,
next_element_from_c_string,
next_element_from_image,
next_element_from_stretch,
next_element_from_xwidget
next_element_from_stretch
#ifdef HAVE_XWIDGETS
,next_element_from_xwidget
#endif
};
#define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it)
...
...
@@ -6832,7 +6848,9 @@ set_iterator_to_next (struct it *it, int reseat_p)
case GET_FROM_IMAGE:
case GET_FROM_STRETCH:
#ifdef HAVE_XWIDGETS
case GET_FROM_XWIDGET:
#endif
/* The position etc with which we have to proceed are on
the stack. The position may be at the end of a string,
if the `display' property takes up the whole string. */
...
...
@@ -7259,6 +7277,7 @@ next_element_from_image (struct it *it)
return 1;
}
#ifdef HAVE_XWIDGETS
/* im not sure about this FIXME JAVE*/
static int
next_element_from_xwidget (struct it *it)
...
...
@@ -7269,7 +7288,7 @@ next_element_from_xwidget (struct it *it)
//printf("xwidget_id %d: in next_element_from_xwidget: FIXME \n", it->xwidget_id);
return 1;
}
#endif
/* Fill iterator IT with next display element from a stretch glyph
...
...
@@ -17206,6 +17225,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
glyph->left_box_line_p,
glyph->right_box_line_p);
}
#ifdef HAVE_XWIDGETS
else if (glyph->type == XWIDGET_GLYPH)
{
fprintf (stderr,
...
...
@@ -17227,6 +17247,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
// printf("dump xwidget glyph\n");
}
#endif
}
...
...
@@ -17600,10 +17621,7 @@ static void
compute_line_metrics (struct it *it)
{
struct glyph_row *row = it->glyph_row;
if(row->used[TEXT_AREA] > 1000){
printf("compute_line_metrics %d %d %d\n", row->used[TEXT_AREA], it->f->text_cols, row->end.pos.charpos);
printf("row->used[TEXT_AREA] seems weirdly big! emacs will crash soon\n");
}
if (FRAME_WINDOW_P (it->f))
{
int i, min_y, max_y;
...
...
@@ -21332,12 +21350,13 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
return OK_PIXELS (width_p ? img->width : img->height);
}
#ifdef HAVE_XWIDGETS
if (FRAME_WINDOW_P (it->f) && valid_xwidget_p (prop))
{
printf("calc_pixel_width_or_height: return dummy size FIXME\n");
return OK_PIXELS (width_p ? 100 : 100);
}
#endif
#endif
if (EQ (car, Qplus) || EQ (car, Qminus))
{
...
...
@@ -21832,6 +21851,7 @@ fill_image_glyph_string (struct glyph_string *s)
s->ybase += s->first_glyph->voffset;
}
#ifdef HAVE_XWIDGETS
static void
fill_xwidget_glyph_string (struct glyph_string *s)
{
...
...
@@ -21844,7 +21864,7 @@ fill_xwidget_glyph_string (struct glyph_string *s)
s->xwidget = s->first_glyph->u.xwidget;
//assert_valid_xwidget_id ( s->xwidget, "fill_xwidget_glyph_string");
}
#endif
/* Fill glyph string S from a sequence of stretch glyphs.
START is the index of the first glyph to consider,
...
...
@@ -22176,6 +22196,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
} \
while (0)
#ifdef HAVE_XWIDGETS
#define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
do \
{ \
...
...
@@ -22188,7 +22209,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
s->x = (X); \
} \
while (0)
#endif
/* Add a glyph string for a sequence of character glyphs to the list
...
...
@@ -22348,7 +22369,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
BUILD_XWIDGET_GLYPH_STRING (START, END, HEAD, TAIL, \
HL, X, LAST_X); \
break; \
\
\
\
case GLYPHLESS_GLYPH: \
BUILD_GLYPHLESS_GLYPH_STRING (START, END, HEAD, TAIL, \
...
...
@@ -22960,6 +22981,7 @@ produce_image_glyph (struct it *it)
}
}
#ifdef HAVE_XWIDGETS
static void
produce_xwidget_glyph (struct it *it)
{
...
...
@@ -23041,7 +23063,7 @@ produce_xwidget_glyph (struct it *it)
IT_EXPAND_MATRIX_WIDTH (it, area);
}
}
#endif
/* Append a stretch glyph to IT->glyph_row. OBJECT is the source
of the glyph, WIDTH and HEIGHT are the width and height of the
...
...
@@ -24215,9 +24237,10 @@ x_produce_glyphs (struct it *it)
produce_image_glyph (it);
else if (it->what == IT_STRETCH)
produce_stretch_glyph (it);
#ifdef HAVE_XWIDGETS
else if (it->what == IT_XWIDGET)
produce_xwidget_glyph (it);
#endif
done:
/* Accumulate dimensions. Note: can't assume that it->descent > 0
because this isn't true for images with `:ascent 100'. */
...
...
@@ -24579,10 +24602,12 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
if (!w->cursor_off_p)
{
#ifdef HAVE_XWIDGETS
if (glyph != NULL && glyph->type == XWIDGET_GLYPH){
printf("attempt xwidget cursor avoidance in get_window_cursor_type\n");
return NO_CURSOR;
}
#endif
if (glyph != NULL && glyph->type == IMAGE_GLYPH)
{
if (cursor_type == FILLED_BOX_CURSOR)
...
...
src/xterm.c
View file @
c8937ab9
...
...
@@ -62,7 +62,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "coding.h"
#include "frame.h"
#include "dispextern.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
#include "fontset.h"
#include "termhooks.h"
#include "termopts.h"
...
...
@@ -2680,13 +2682,13 @@ x_draw_glyph_string (struct glyph_string *s)
case IMAGE_GLYPH:
x_draw_image_glyph_string (s);
break;
#ifdef HAVE_XWIDGETS
case XWIDGET_GLYPH:
//erase xwidget background
x_draw_glyph_string_background (s, 0);
x_draw_xwidget_glyph_string (s);
break;
#endif
case STRETCH_GLYPH:
x_draw_stretch_glyph_string (s);
break;
...
...
@@ -7255,10 +7257,12 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
cursor_glyph = get_phys_cursor_glyph (w);
if (cursor_glyph == NULL)
return;
#ifdef HAVE_XWIDGETS
if (cursor_glyph->type == XWIDGET_GLYPH){
printf("tried avoiding xwidget cursor\n");
return; //experimental avoidance of cursor on xwidget
}
#endif
/* If on an image, draw like a normal cursor. That's usually better
visible than drawing a bar, esp. if the image is large so that
the bar might not be in the window. */
...
...
src/xwidget-attic.c
deleted
100644 → 0
View file @
e9a96749
static
int
once
=
0
;
int
xwidget_has_composition
(
void
){
//unused
int
event_base
,
error_base
;
Display
*
dpy
=
GDK_DISPLAY
();
int
i
;
if
(
xwidget_query_composition_called
)
return
hasNamePixmap
;
xwidget_query_composition_called
=
1
;
//do this once in an emacs session
if
(
gdk_display_supports_composite
(
gdk_display_get_default
())){
hasNamePixmap
=
1
;
}
else
{
return
0
;
}
return
1
;
}
void
xwidget_end_composition
(
struct
xwidget
*
w
){
//unused
//XCompositeUnredirectWindow(); stop redirecting, should be called when the socket is destroyed
}
static
gboolean
xwidget_composite_draw_phantom
(
struct
xwidget
*
xw
,
int
x
,
int
y
,
int
clipx
,
int
clipy
)
{
FRAME_PTR
f
=
(
FRAME_PTR
)
g_object_get_data
(
G_OBJECT
(
xw
->
widget
),
XG_FRAME_DATA
);
////////////////////////////////////////////////////////////////
//Example 7. Composited windows
GdkRegion
*
region
;
GtkWidget
*
child
;
cairo_t
*
cr
;
printf
(
"xwidget_composite_draw_2 at:%d %d
\n
"
,
x
,
y
);
/* get our child (in this case, the event box) */
child
=
xw
->
widget
;
//gtk_bin_get_child (GTK_BIN (widget));
/* create a cairo context to draw to the emacs window */
cr
=
gdk_cairo_create
(
gtk_widget_get_window
(
FRAME_GTK_WIDGET
(
s
->
f
)));
//GTK_WIDGET(xw->emacswindow));//));//widget->window);
/* the source data is the (composited) xwidget */
//cairo_move_to(cr, xw->x, xw->y);
cairo_rectangle
(
cr
,
x
,
y
,
clipx
,
clipy
);
cairo_clip
(
cr
);
cairo_set_source_rgb
(
cr
,
1
.
0
,
0
,
0
);
cairo_rectangle
(
cr
,
x
,
y
,
xw
->
width
,
xw
->
height
);
cairo_fill
(
cr
);
gdk_cairo_set_source_pixmap
(
cr
,
child
->
window
,
x
,
//child->allocation.x,
y
//child->allocation.y
);
/* draw no more than our expose event intersects our child */
/* region = gdk_region_rectangle (&child->allocation);
gdk_region_intersect (region, event->region);
gdk_cairo_region (cr, region);
cairo_clip (cr); */
/* composite, with a 50% opacity */
cairo_set_operator
(
cr
,
CAIRO_OPERATOR_OVER
);
//cairo_paint_with_alpha (cr, phantom ? 0.5 : 0);
cairo_paint_with_alpha
(
cr
,
0
.
9
);
//cairo_paint(cr);//transparency);
/* we're done */
cairo_destroy
(
cr
);
return
FALSE
;
}
/*
static gboolean
xwidget_composite_draw(GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
{
struct xwidget* xw = (struct xwidget*) g_object_get_data (G_OBJECT (widget), XG_XWIDGET);
printf("xwidget_composite_draw %s\n", data);
xwidget_composite_draw_2(widget,
event,
data,
xw->x, xw->y, 0);
return FALSE;
}
*/
static
gboolean
xwidget_composite_draw_widgetwindow
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
,
gpointer
data
)
{
struct
xwidget
*
xw
=
(
struct
xwidget
*
)
g_object_get_data
(
G_OBJECT
(
widget
),
XG_XWIDGET
);
cairo_t
*
cr
;
GdkPixmap
*
pixmap
;
pixmap
=
xw
->
widget
->
window
;
printf
(
"xwidget_composite_draw_widgetwindow xw.id:%d xw.type:%d window:%d
\n
"
,
xw
->
id
,
xw
->
type
,
gtk_widget_get_window
(
widget
));
//if(xw->type!=3)//TODO this is just trial and terror to see if i can draw the live socket anywhere at all
cr
=
gdk_cairo_create
(
gtk_widget_get_window
(
widget
));
//GTK_LAYOUT (xw->widgetwindow)->bin_window);//
//else cr = gdk_cairo_create (gtk_widget_get_window (xw->emacswindow));
cairo_rectangle
(
cr
,
0
,
0
,
xw
->
width
,
xw
->
height
);
cairo_clip
(
cr
);
cairo_set_source_rgb
(
cr
,
0
,
1
.
0
,
0
);
cairo_rectangle
(
cr
,
0
,
0
,
xw
->
width
,
xw
->
height
);
cairo_fill
(
cr
);
gdk_cairo_set_source_pixmap
(
cr
,
pixmap
,
0
,
0
);
cairo_set_operator
(
cr
,
CAIRO_OPERATOR_OVER
);
cairo_paint_with_alpha
(
cr
,
0
.
9
);
//cairo_paint(cr);
cairo_destroy
(
cr
);
return
FALSE
;
}
//type support nevermind for now