Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,34 @@
from Xlib import X, display
class Window:
def __init__(self, display, msg):
self.display = display
self.msg = msg
self.screen = self.display.screen()
self.window = self.screen.root.create_window(
10, 10, 100, 100, 1,
self.screen.root_depth,
background_pixel=self.screen.white_pixel,
event_mask=X.ExposureMask | X.KeyPressMask,
)
self.gc = self.window.create_gc(
foreground = self.screen.black_pixel,
background = self.screen.white_pixel,
)
self.window.map()
def loop(self):
while True:
e = self.display.next_event()
if e.type == X.Expose:
self.window.fill_rectangle(self.gc, 20, 20, 10, 10)
self.window.draw_text(self.gc, 10, 50, self.msg)
elif e.type == X.KeyPress:
raise SystemExit
if __name__ == "__main__":
Window(display.Display(), "Hello, World!").loop()

View file

@ -0,0 +1,43 @@
import xcb
from xcb.xproto import *
import xcb.render
def main():
conn = xcb.connect()
conn.render = conn(xcb.render.key)
setup = conn.get_setup()
root = setup.roots[0].root
depth = setup.roots[0].root_depth
visual = setup.roots[0].root_visual
white = setup.roots[0].white_pixel
window = conn.generate_id()
conn.core.CreateWindow(depth, window, root,
0, 0, 640, 480, 0,
WindowClass.InputOutput,
visual,
CW.BackPixel | CW.EventMask,
[ white, EventMask.Exposure |
EventMask.KeyPress ])
conn.core.MapWindow(window)
conn.flush()
while True:
event = conn.wait_for_event()
if isinstance(event, ExposeEvent):
color = (0, 0, 65535, 65535)
rectangle = (20, 20, 40, 40)
# TODO, fixme:
# I haven't been able to find what I should put for the parameter "op"
# conn.render.FillRectangles(op, window, color, 1, rectangle)
conn.flush()
elif isinstance(event, KeyPressEvent):
break
conn.disconnect()
main()