Commit 095bea45 authored by Eric Warmenhoven's avatar Eric Warmenhoven Committed by Eric Warmenhoven
Browse files

More proper vt switch handling

Wed Dec  4 19:41:14 2002  Eric Warmenhoven <eric@warmenhoven.org>

	* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
	gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
	gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
parent 55f1544e
Wed Dec 4 19:41:14 2002 Eric Warmenhoven <eric@warmenhoven.org>
* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
Wed Dec 4 14:31:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Always look up and create the
......
Wed Dec 4 19:41:14 2002 Eric Warmenhoven <eric@warmenhoven.org>
* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
Wed Dec 4 14:31:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Always look up and create the
......
Wed Dec 4 19:41:14 2002 Eric Warmenhoven <eric@warmenhoven.org>
* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
Wed Dec 4 14:31:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Always look up and create the
......
Wed Dec 4 19:41:14 2002 Eric Warmenhoven <eric@warmenhoven.org>
* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
Wed Dec 4 14:31:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Always look up and create the
......
Wed Dec 4 19:41:14 2002 Eric Warmenhoven <eric@warmenhoven.org>
* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
Wed Dec 4 14:31:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Always look up and create the
......
Wed Dec 4 19:41:14 2002 Eric Warmenhoven <eric@warmenhoven.org>
* gdk/linux-fb/gdkglobals-fb.c gdk/linux-fb/gdkkeyboard-fb.c
gdk/linux-fb/gdkmain-fb.c gdk/linux-fb/gdkprivate-fb.h
gdk/linux-fb/gdkrender-fb.c: More proper vt switch handling
Wed Dec 4 14:31:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Always look up and create the
......
......@@ -45,3 +45,4 @@ GdkCursor *_gdk_fb_pointer_grab_cursor;
GdkGC *_gdk_fb_screen_gc = NULL;
GdkAtom _gdk_selection_property;
GdkFBAngle _gdk_fb_screen_angle = GDK_FB_0_DEGREES;
volatile gboolean _gdk_fb_is_active_vt = FALSE;
......@@ -1327,8 +1327,6 @@ raw_io (GIOChannel *gioc,
/* Do the whole funky VT switch thing */
ioctl (gdk_display->console_fd, VT_ACTIVATE, vtnum);
ioctl (gdk_display->console_fd, VT_WAITACTIVE, gdk_display->vt);
gdk_fb_redraw_all ();
}
continue;
......
......@@ -679,12 +679,48 @@ gdk_fb_manager_connect (GdkFBDisplay *display)
#endif
}
static void
gdk_fb_switch (int sig)
{
if (sig == SIGUSR1)
{
ioctl (gdk_display->tty_fd, VT_RELDISP, 1);
_gdk_fb_is_active_vt = FALSE;
gdk_shadow_fb_stop_updates ();
gdk_fb_mouse_close ();
gdk_fb_keyboard_close ();
}
else
{
GdkColormap *cmap;
ioctl (gdk_display->tty_fd, VT_RELDISP, VT_ACKACQ);
_gdk_fb_is_active_vt = TRUE;
/* XXX: is it dangerous to put all this stuff in a signal handler? */
cmap = gdk_screen_get_default_colormap (_gdk_screen);
gdk_colormap_change (cmap, cmap->size);
gdk_shadow_fb_update (0, 0,
gdk_display->fb_width,
gdk_display->fb_height);
if (!gdk_fb_keyboard_open ())
g_warning ("Failed to re-initialize keyboard");
if (!gdk_fb_mouse_open ())
g_warning ("Failed to re-initialize mouse");
gdk_fb_redraw_all ();
}
}
static GdkFBDisplay *
gdk_fb_display_new ()
{
GdkFBDisplay *display;
gchar *fb_filename;
struct vt_stat vs;
struct vt_mode vtm;
int vt, n;
gchar *s, *send;
char buf[32];
......@@ -744,9 +780,18 @@ gdk_fb_display_new ()
return NULL;
}
/* Set controlling tty */
ioctl (0, TIOCNOTTY, 0);
ioctl (display->tty_fd, TIOCSCTTY, 0);
/* set up switch signals */
if (ioctl (display->tty_fd, VT_GETMODE, &vtm) >= 0)
{
signal (SIGUSR1, gdk_fb_switch);
signal (SIGUSR2, gdk_fb_switch);
vtm.mode = VT_PROCESS;
vtm.waitv = 0;
vtm.relsig = SIGUSR1;
vtm.acqsig = SIGUSR2;
ioctl (display->tty_fd, VT_SETMODE, &vtm);
}
_gdk_fb_is_active_vt = TRUE;
fb_filename = gdk_get_display ();
display->fb_fd = open (fb_filename, O_RDWR);
......
......@@ -427,7 +427,9 @@ extern gboolean _gdk_fb_keyboard_grab_owner_events;
extern GdkFBDisplay *gdk_display;
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
extern FILE *debug_out;
extern volatile gboolean _gdk_fb_is_active_vt;
GdkEvent *gdk_event_make(GdkWindow *window,
GdkEventType type,
gboolean append_to_queue);
......
......@@ -235,6 +235,9 @@ gdk_fb_set_pixel_1(GdkDrawable *drawable,
guint rowstride = private->rowstride;
guchar *ptr;
if (!_gdk_fb_is_active_vt)
return;
g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
ptr = mem + (y*rowstride) + (x >> 3);
......@@ -256,6 +259,9 @@ gdk_fb_set_pixel_8(GdkDrawable *drawable,
guchar *mem = private->mem;
guint rowstride = private->rowstride;
if (!_gdk_fb_is_active_vt)
return;
g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
mem[x + y*rowstride] = pixel;
......@@ -273,6 +279,9 @@ gdk_fb_set_pixel_16(GdkDrawable *drawable,
guint rowstride = private->rowstride;
guint16 *ptr;
if (!_gdk_fb_is_active_vt)
return;
g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
ptr = (guint16 *)&mem[x*2 + y*rowstride];
......@@ -291,6 +300,9 @@ gdk_fb_set_pixel_24(GdkDrawable *drawable,
guint rowstride = private->rowstride;
guchar *smem;
if (!_gdk_fb_is_active_vt)
return;
g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
smem = &mem[x*3 + y*rowstride];
......@@ -311,6 +323,9 @@ gdk_fb_set_pixel_32(GdkDrawable *drawable,
guint rowstride = private->rowstride;
guint32 *smem;
if (!_gdk_fb_is_active_vt)
return;
g_assert (private->depth == GDK_GC_FBDATA (gc)->depth);
smem = (guint32 *)&mem[x*4 + y*rowstride];
......@@ -343,6 +358,9 @@ gdk_fb_fill_span_generic (GdkDrawable *drawable,
gboolean solid_stipple;
GdkFunction func;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -501,6 +519,9 @@ gdk_fb_fill_span_simple_1 (GdkDrawable *drawable,
guint rowstride;
gint left, right, y;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -567,6 +588,9 @@ gdk_fb_fill_span_simple_8 (GdkDrawable *drawable,
guchar *mem, *ptr;
guint rowstride;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -583,6 +607,7 @@ gdk_fb_fill_span_simple_8 (GdkDrawable *drawable,
ptr = mem + span->y*rowstride + span->x;
memset (ptr, color->pixel, span->width);
}
static void
gdk_fb_fill_span_simple_16 (GdkDrawable *drawable,
GdkGC *gc,
......@@ -597,6 +622,9 @@ gdk_fb_fill_span_simple_16 (GdkDrawable *drawable,
int n;
int i;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -630,6 +658,9 @@ gdk_fb_fill_span_simple_24 (GdkDrawable *drawable,
guchar redval, greenval, blueval;
guchar *firstline, *ptr_end;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -659,6 +690,7 @@ gdk_fb_fill_span_simple_24 (GdkDrawable *drawable,
ptr += 3;
}
}
static void
gdk_fb_fill_span_simple_32 (GdkDrawable *drawable,
GdkGC *gc,
......@@ -673,6 +705,9 @@ gdk_fb_fill_span_simple_32 (GdkDrawable *drawable,
int n;
int i;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -880,6 +915,9 @@ gdk_fb_draw_drawable_memmove (GdkDrawable *drawable,
int linelen = (end_x - start_x)*(depth>>3);
gint cur_y;
if (!_gdk_fb_is_active_vt)
return;
if (draw_direction < 0)
{
int tmp;
......@@ -925,6 +963,9 @@ gdk_fb_draw_drawable_aa_24 (GdkDrawable *drawable,
GdkColor fg;
gint fg_r, fg_g, fg_b;
if (!_gdk_fb_is_active_vt)
return;
gc_private = GDK_GC_FBDATA (gc);
fg = GDK_GC_FBDATA (gc)->values.foreground;
......@@ -1006,6 +1047,9 @@ gdk_fb_fill_rectangle_generic (GdkDrawable *drawable,
GdkSpan *spans;
int i;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
spans = g_new (GdkSpan, rect->height);
......@@ -1035,6 +1079,9 @@ gdk_fb_fill_rectangle_simple_16 (GdkDrawable *drawable,
guint32 pixel;
gint height;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -1081,6 +1128,9 @@ gdk_fb_fill_rectangle_simple_32 (GdkDrawable *drawable,
guint32 pixel;
gint height;
if (!_gdk_fb_is_active_vt)
return;
private = GDK_DRAWABLE_FBDATA (drawable);
gc_private = GDK_GC_FBDATA (gc);
......@@ -1212,6 +1262,9 @@ gdk_shadow_fb_copy_rect_0 (gint x, gint y, gint width, gint height)
guchar *dst, *src;
gint depth;
if (!_gdk_fb_is_active_vt)
return;
depth = gdk_display->modeinfo.bits_per_pixel / 8;
dst = gdk_display->fb_mmap + x * depth + gdk_display->sinfo.line_length * y;
......@@ -1235,6 +1288,9 @@ gdk_shadow_fb_copy_rect_90 (gint x, gint y, gint width, gint height)
gint w;
gint i;
if (!_gdk_fb_is_active_vt)
return;
depth = gdk_display->modeinfo.bits_per_pixel / 8;
src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
......@@ -1264,6 +1320,9 @@ gdk_shadow_fb_copy_rect_180 (gint x, gint y, gint width, gint height)
gint w;
gint i;
if (!_gdk_fb_is_active_vt)
return;
depth = gdk_display->modeinfo.bits_per_pixel / 8;
src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
......@@ -1293,6 +1352,9 @@ gdk_shadow_fb_copy_rect_270 (gint x, gint y, gint width, gint height)
gint w;
gint i;
if (!_gdk_fb_is_active_vt)
return;
depth = gdk_display->modeinfo.bits_per_pixel / 8;
src = gdk_display->fb_mem + x * depth + gdk_display->fb_stride * y;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment