vesainit.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. Copyright (c) 2000 by Juliusz Chroboczek
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #ifdef HAVE_CONFIG_H
  20. #include <kdrive-config.h>
  21. #endif
  22. #include "vesa.h"
  23. #include <sys/utsname.h>
  24. static const KdCardFuncs vesaFuncs = {
  25. vesaCardInit, /* cardinit */
  26. vesaScreenInit, /* scrinit */
  27. vesaInitScreen, /* initScreen */
  28. vesaFinishInitScreen, /* finishInitScreen */
  29. vesaCreateResources, /* createRes */
  30. vesaPreserve, /* preserve */
  31. vesaEnable, /* enable */
  32. vesaDPMS, /* dpms */
  33. vesaDisable, /* disable */
  34. vesaRestore, /* restore */
  35. vesaScreenFini, /* scrfini */
  36. vesaCardFini, /* cardfini */
  37. 0, /* initCursor */
  38. 0, /* enableCursor */
  39. 0, /* disableCursor */
  40. 0, /* finiCursor */
  41. 0, /* recolorCursor */
  42. 0, /* initAccel */
  43. 0, /* enableAccel */
  44. 0, /* disableAccel */
  45. 0, /* finiAccel */
  46. vesaGetColors, /* getColors */
  47. vesaPutColors, /* putColors */
  48. };
  49. void InitCard(char *name)
  50. {
  51. KdCardInfoAdd(&vesaFuncs, 0);
  52. }
  53. void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
  54. {
  55. KdInitOutput(pScreenInfo, argc, argv);
  56. }
  57. void InitInput(int argc, char **argv)
  58. {
  59. KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
  60. }
  61. void ddxUseMsg(void)
  62. {
  63. KdUseMsg();
  64. vesaUseMsg();
  65. }
  66. int ddxProcessArgument(int argc, char **argv, int i)
  67. {
  68. int ret;
  69. // This is the earliest hook point. Don't start on 64-bit for now.
  70. static int checked64 = 0;
  71. if (!checked64) {
  72. checked64 = 1;
  73. struct utsname info;
  74. if (!uname(&info)) {
  75. if (!strcmp("x86_64", info.machine)) {
  76. ErrorF("Xvesa is not 64-bit compatible.\n");
  77. exit(1);
  78. }
  79. }
  80. }
  81. if (!strcmp(argv[i], "-version")) {
  82. kdVersion("Xvesa");
  83. exit(0);
  84. }
  85. if (!(ret = vesaProcessArgument(argc, argv, i)))
  86. ret = KdProcessArgument(argc, argv, i);
  87. return ret;
  88. }