summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Ferreira <lnf07@c3sl.ufpr.br>2008-08-21 11:58:54 -0300
committerLucas Ferreira <lnf07@c3sl.ufpr.br>2008-08-21 11:58:54 -0300
commit2fb9ba683ec700ee21910e768a74cd6d7ab1088b (patch)
treeb86ed2383d2893587f42c29b16a14c0e118b2a13
parent42e52660391d9dad224e77e126e55b42c47fd457 (diff)
Change the order that the parent window is open.
Now it is open before everything.
-rw-r--r--extra-modes/xephyr-gdm/src/xephyr-gdm4
-rw-r--r--mdm/Makefile6
-rwxr-xr-xmdm/misc/make-tree.sh2
-rw-r--r--mdm/modes/xephyr-xdmcp6
-rw-r--r--mdm/src/.gitignore2
-rwxr-xr-xmdm/src/mdm-start-seat26
-rw-r--r--mdm/src/seat-parent-window.c (renamed from mdm/src/xephyr-parent-window.c)0
-rw-r--r--mdm/src/write-message.c59
-rwxr-xr-xmdm/src/xephyr-wrapper16
9 files changed, 64 insertions, 57 deletions
diff --git a/extra-modes/xephyr-gdm/src/xephyr-gdm b/extra-modes/xephyr-gdm/src/xephyr-gdm
index 7434c8c..678741e 100644
--- a/extra-modes/xephyr-gdm/src/xephyr-gdm
+++ b/extra-modes/xephyr-gdm/src/xephyr-gdm
@@ -80,7 +80,7 @@ function display_manager_start_seat () {
# seat
echo "Xephyr :${SEAT_NUMBER} -br"
- echo " -geometry ${MY_SCREEN_SIZE}+0+0"
+ echo " -parent $SEAT_WINDOW_ID"
echo " -mouse evdev,,device=$MOUSE"
echo " -keybd"
echo -n " evdev,,device=$KEYBOARD,xkbmodel=$MY_XKB_MODEL,"
@@ -92,7 +92,7 @@ function display_manager_start_seat () {
$GDMDYNAMIC "-a ${SEAT_NUMBER}=${XEPHYR_WRAPPER} -br :${SEAT_NUMBER} \
-display $DISPLAY \
-xauthority $XAUTHORITY \
- -geometry ${MY_SCREEN_SIZE}+0+0 \
+ -parent $SEAT_WINDOW_ID \
-mouse evdev,,device=$MOUSE \
-keybd \
evdev,,device=$KEYBOARD,xkbmodel=$MY_XKB_MODEL,xkblayout=$MY_XKB_LAYOUT"
diff --git a/mdm/Makefile b/mdm/Makefile
index acd4b2e..2114e51 100644
--- a/mdm/Makefile
+++ b/mdm/Makefile
@@ -51,14 +51,14 @@ prefix:
misc/change-prefix.sh $(DESTDIR); \
fi
-binaries: src/read-devices.c src/write-message.c src/xephyr-parent-window.c
+binaries: src/read-devices.c src/write-message.c src/seat-parent-window.c
$(CC) $(CFLAGS) src/read-devices.c -o src/read-devices
$(CC) $(CFLAGS) src/write-message.c -o src/write-message `pkg-config --libs --cflags cairo x11`
- $(CC) $(CFLAGS) src/xephyr-parent-window.c -o src/xephyr-parent-window `pkg-config --libs --cflags x11`
+ $(CC) $(CFLAGS) src/seat-parent-window.c -o src/seat-parent-window `pkg-config --libs --cflags x11`
clean:
rm -f src/read-devices
rm -f src/write-message
- rm -f src/xephyr-parent-window
+ rm -f src/seat-parent-window
rm -rf *tree
rm -rf packages
diff --git a/mdm/misc/make-tree.sh b/mdm/misc/make-tree.sh
index b015d53..a4a6472 100755
--- a/mdm/misc/make-tree.sh
+++ b/mdm/misc/make-tree.sh
@@ -56,7 +56,7 @@ cp src/mdm-start-seat $TARGET/$MDM_SCRIPTS/
cp src/create-xorg-conf $TARGET/$MDM_SCRIPTS/
cp src/write-message $TARGET/$MDM_SCRIPTS/
cp src/xephyr-wrapper $TARGET/$MDM_SCRIPTS/
-cp src/xephyr-parent-window $TARGET/$MDM_SCRIPTS/
+cp src/seat-parent-window $TARGET/$MDM_SCRIPTS/
cp src/read-devices $TARGET/$MDM_SCRIPTS/
cp src/discover-devices $TARGET/$MDM_SCRIPTS/
cp -r modes $TARGET/$MDM_SHARE/
diff --git a/mdm/modes/xephyr-xdmcp b/mdm/modes/xephyr-xdmcp
index c6afd3c..cdd21f0 100644
--- a/mdm/modes/xephyr-xdmcp
+++ b/mdm/modes/xephyr-xdmcp
@@ -80,15 +80,15 @@ function display_manager_start_seat () {
# seat
echo "xephyr-wrapper :${SEAT_NUMBER} -br"
- echo " -geometry ${MY_SCREEN_SIZE}+0+0"
+ echo " -parent $SEAT_WINDOW_ID"
echo " -mouse evdev,,device=$MOUSE"
echo " -keybd"
echo -n " evdev,,device=$KEYBOARD,xkbmodel=$MY_XKB_MODEL,"
echo "xkblayout=$MY_XKB_LAYOUT"
echo " -${CONNECTION_TYPE} ${CONNECTION_TARGET} 2>&1 &"
- $XEPHYR_WRAPPER :${SEAT_NUMBER} -br \
- -geometry ${MY_SCREEN_SIZE}+0+0 \
+ $XEPHYR_WRAPPER :${SEAT_NUMBER} -br \
+ -parent ${SEAT_WINDOW_ID} \
-mouse evdev,,device=$MOUSE \
-keybd \
evdev,,device=$KEYBOARD,xkbmodel=$MY_XKB_MODEL,xkblayout=$MY_XKB_LAYOUT \
diff --git a/mdm/src/.gitignore b/mdm/src/.gitignore
index 54f060e..3a5e97b 100644
--- a/mdm/src/.gitignore
+++ b/mdm/src/.gitignore
@@ -1,3 +1,3 @@
read-devices
write-message
-xephyr-parent-window
+seat-parent-window
diff --git a/mdm/src/mdm-start-seat b/mdm/src/mdm-start-seat
index 7075ef8..968d6a3 100755
--- a/mdm/src/mdm-start-seat
+++ b/mdm/src/mdm-start-seat
@@ -30,24 +30,38 @@ source $MDM_INCLUDE
READ_DEVICES=${MDM_SCRIPTS}/read-devices
WRITE_MESSAGE=${MDM_SCRIPTS}/write-message
+SEAT_PARENT_WINDOW=${MDM_SCRIPTS}/seat-parent-window
SEAT_NUMBER=$1
#MY_LOG=$MDM_LOGS/mdm-start-seat.${SEAT_NUMBER}.log
+function open_seat_parent_window () {
+ kill `cat ${MDM_PIDS}/seat-parent-window${DISPLAY}.pid 2> /dev/null`
+ rm -f ${MDM_PIDS}/seat-parent-window${DISPLAY}.pid 2> /dev/null
+
+ $SEAT_PARENT_WINDOW $MY_SCREEN_SIZE+0+0 seat-parent-window$DISPLAY &
+ PID=$!
+ echo $PID > ${MDM_PIDS}/seat-parent-window${DISPLAY}.pid
+
+ SEAT_WINDOW_ID=$(xwininfo -name "seat-parent-window${DISPLAY}" | grep "Window id" | cut -d' ' -f4)
+
+}
+
+
function display_message () {
case $1 in
key_press)
- $WRITE_MESSAGE "Press the F$2 key" 1>&2
+ $WRITE_MESSAGE $SEAT_WINDOW_ID "Press the F$2 key" 1>&2
;;
button_press)
- $WRITE_MESSAGE "Press the mouse left button" 1>&2
+ $WRITE_MESSAGE $SEAT_WINDOW_ID "Press the mouse left button" 1>&2
;;
wait)
- $WRITE_MESSAGE "Please wait" 1>&2
+ $WRITE_MESSAGE $SEAT_WINDOW_ID "Please wait" 1>&2
;;
reconfigure)
- $WRITE_MESSAGE "Press ESC to reconfigure" 1>&2
+ $WRITE_MESSAGE $SEAT_WINDOW_ID "Press ESC to reconfigure" 1>&2
;;
esac
@@ -221,6 +235,10 @@ parse_config_file
KEYBOARD=
MOUSE=
+SEAT_WINDOW_ID=
+
+open_seat_parent_window
+
while (( 1 )); do
#log --log-file-only "Configuring devices..."
diff --git a/mdm/src/xephyr-parent-window.c b/mdm/src/seat-parent-window.c
index bfbf803..bfbf803 100644
--- a/mdm/src/xephyr-parent-window.c
+++ b/mdm/src/seat-parent-window.c
diff --git a/mdm/src/write-message.c b/mdm/src/write-message.c
index 83419d9..d9e14ef 100644
--- a/mdm/src/write-message.c
+++ b/mdm/src/write-message.c
@@ -27,14 +27,18 @@
int main(int argc, char *argv[])
{
int i;
- int screen_num;
- int display_width;
- int display_height;
+ int screen;
+ int win_x, win_y;
+ unsigned int width, height;
+ unsigned int depth;
+ unsigned int border_width;
+ unsigned int win_id;
double y_all_extents = 0.0;
- double x,y;
+ double x, y;
Display *display;
Visual *visual;
+ Window RootWindow;
Window win;
cairo_text_extents_t extents;
@@ -44,29 +48,28 @@ int main(int argc, char *argv[])
display = XOpenDisplay(NULL);
if(display == NULL)
{
- fprintf(stderr, "Cannot open diplay.\n");
+ fprintf(stderr, "Cannot open display.\n");
exit(1);
}
- screen_num = DefaultScreen(display);
+ screen = DefaultScreen(display);
- win = DefaultRootWindow(display);
- display_width = DisplayWidth(display, screen_num);
- display_height = DisplayHeight(display, screen_num);
- visual = DefaultVisual(display, screen_num);
+ sscanf(argv[1], "%x", &win_id);
+ win = win_id;
+
+ XGetGeometry(display, win, &RootWindow, &win_x, &win_y,
+ &width, &height, &border_width, &depth );
+
+ visual = DefaultVisual(display, screen);
surface = cairo_xlib_surface_create (display,
win,
visual,
- display_width,
- display_height );
+ width,
+ height );
cr = cairo_create (surface);
- /*Set black backgroud*/
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
- cairo_paint (cr);
-
cairo_select_font_face (cr, "Arial",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
@@ -74,7 +77,7 @@ int main(int argc, char *argv[])
cairo_set_font_size (cr, 32.0);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- for (i = 1; i <= argc; i++)
+ for (i = 2; i < argc ; i++)
{
cairo_text_extents(cr, argv[i], &extents);
y_all_extents += (extents.height/2 + extents.y_bearing*2);
@@ -83,24 +86,26 @@ int main(int argc, char *argv[])
y_all_extents = y_all_extents/2.0;
cairo_text_extents(cr, argv[1], &extents);
- x = display_width/2 - (extents.width/2 + extents.x_bearing);
- y = display_height/2 - (extents.height/2 + extents.y_bearing);
+ x = width/2 - (extents.width/2 + extents.x_bearing);
+ y = height/2 - (extents.height/2 + extents.y_bearing);
y += y_all_extents;
cairo_move_to(cr, x, y );
-
- for (i = 1; i < argc; i++)
+
+ XClearWindow(display, win);
+
+ for (i = 2; i < argc ; i++)
{
cairo_text_extents(cr, argv[i], &extents);
- x = display_width/2 - (extents.width/2 + extents.x_bearing);
-
- cairo_move_to (cr, x, y );
+ x = width/2 - (extents.width/2 + extents.x_bearing);
+
+ cairo_move_to (cr, x, y );
cairo_show_text (cr, argv[i]);
-
- y -= (extents.height/2 + extents.y_bearing*2 );
+
+ y -= (extents.height/2 + extents.y_bearing*2 );
}
-
+
XCloseDisplay(display);
return 0;
diff --git a/mdm/src/xephyr-wrapper b/mdm/src/xephyr-wrapper
index 3d867a2..cbd2970 100755
--- a/mdm/src/xephyr-wrapper
+++ b/mdm/src/xephyr-wrapper
@@ -20,13 +20,6 @@
MDM_PREFIX=/
MDM_SCRIPTS=${MDM_PREFIX}/usr/sbin
-MDM_INCLUDE=${MDM_SCRIPTS}/mdm-common
-source $MDM_INCLUDE
-
-XEPHYR_PARENT_WINDOW=${MDM_SCRIPTS}/xephyr-parent-window
-
-kill `cat ${MDM_PIDS}/xephyr-parent-window${DISPLAY}.pid 2> /dev/null`
-rm -f ${MDM_PIDS}/xephyr-parent-window${DISPLAY}.pid 2> /dev/null
while (( $# > 0 )); do
case "$1" in
@@ -38,15 +31,6 @@ while (( $# > 0 )); do
export DISPLAY=$2
shift 2
;;
- -geometry)
- ${XEPHYR_PARENT_WINDOW} $2 "xephyr_parent_window${DISPLAY}" &
- PID=$!
- echo $PID > ${MDM_PIDS}/xephyr-parent-window${DISPLAY}.pid
-
- WINDOW_ID=$(xwininfo -name "xephyr_parent_window${DISPLAY}" | grep "Window id" | cut -d' ' -f4)
- XEPHYR_ARGS="$XEPHYR_ARGS -parent $WINDOW_ID"
- shift 2
- ;;
*)
XEPHYR_ARGS="$XEPHYR_ARGS $1"
shift 1