vt.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
  3. (c) Copyright 2000-2004 Convergence (integrated media) GmbH
  4. All rights reserved.
  5. Written by Denis Oliver Kropp <dok@directfb.org>,
  6. Andreas Hundt <andi@fischlustig.de>,
  7. Sven Neumann <neo@directfb.org>,
  8. Ville Syrjälä <syrjala@sci.fi> and
  9. Claudio Ciccani <klan@users.sf.net>.
  10. This library is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU Lesser General Public
  12. License as published by the Free Software Foundation; either
  13. version 2 of the License, or (at your option) any later version.
  14. This library is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. Lesser General Public License for more details.
  18. You should have received a copy of the GNU Lesser General Public
  19. License along with this library; if not, write to the
  20. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef __VT_H__
  24. #define __VT_H__
  25. #include <signal.h>
  26. #include <termios.h>
  27. #include <unistd.h>
  28. #include <linux/vt.h>
  29. #include <directfb.h>
  30. typedef struct {
  31. int fd0; /* file descriptor of /dev/tty0 */
  32. int fd; /* file descriptor of /dev/ttyN
  33. where N is the number of the allocated VT,
  34. may be equal to 'fd0' if VT allocation
  35. is disabled by "--no-vt-switch" */
  36. int num; /* number of vt where DirectFB runs */
  37. int prev; /* number of vt DirectFB was started from */
  38. int old_fb; /* original fb mapped to vt */
  39. struct sigaction sig_usr1; /* previous signal handler for USR1 */
  40. struct sigaction sig_usr2; /* previous signal handler for USR2 */
  41. struct vt_mode vt_mode; /* previous VT mode */
  42. DirectThread *thread;
  43. pthread_mutex_t lock;
  44. pthread_cond_t wait;
  45. int vt_sig;
  46. struct termios old_ts;
  47. bool flush;
  48. DirectThread *flush_thread;
  49. } VirtualTerminal;
  50. /*
  51. * allocates and switches to a new virtual terminal
  52. */
  53. DFBResult dfb_vt_initialize( void );
  54. DFBResult dfb_vt_join( void );
  55. /*
  56. * deallocates virtual terminal
  57. */
  58. DFBResult dfb_vt_shutdown( bool emergency );
  59. DFBResult dfb_vt_leave( bool emergency );
  60. DFBResult dfb_vt_detach( bool force );
  61. bool dfb_vt_switch( int num );
  62. #endif