Advertisement
Guest User

Untitled

a guest
Feb 25th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. // fullscreenhack.c
  2. // Alistair Buxton <a.j.buxton@gmail.com>
  3.  
  4. // options:
  5. // the real height and width of all your monitors
  6. // this is what tester should report without the hack
  7. #define REAL_WIDTH (3200)
  8. #define REAL_HEIGHT (1200)
  9.  
  10. // the height and width of the primary monitor where flash
  11. // goes fullscreen
  12. #define FAKE_WIDTH (1920)
  13. #define FAKE_HEIGHT (1200)
  14.  
  15. #include <dlfcn.h>
  16. #include <stdio.h>
  17. #include <X11/Xlib.h>
  18.  
  19. void __attribute__ ((constructor)) load(void);
  20.  
  21. // Called when the library is loaded and before dlopen() returns
  22. void load(void)
  23. {
  24. printf("fullscreen hack loaded...\n");
  25. }
  26.  
  27. Status XGetGeometry(Display *display, Drawable d, Window *root_return,
  28. int *x_return, int *y_return,
  29. unsigned int *width_return,
  30. unsigned int *height_return,
  31. unsigned int *border_width_return,
  32. unsigned int *depth_return)
  33. {
  34.  
  35. typedef Status (*func)(Display *, Drawable, Window *,
  36. int *, int *, unsigned int *,
  37. unsigned int *, unsigned int *,
  38. unsigned int *);
  39. void *handle;
  40. Status s;
  41. handle = dlopen("libX11.so", RTLD_LAZY);
  42. func orig = dlsym(handle, "XGetGeometry");
  43. s = orig(display, d, root_return,
  44. x_return, y_return,
  45. width_return, height_return,
  46. border_width_return, depth_return);
  47.  
  48. if(*width_return == REAL_WIDTH) *width_return = FAKE_WIDTH;
  49. if(*height_return == REAL_HEIGHT) *height_return = FAKE_HEIGHT;
  50. return s;
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement