mirror of
				https://git.1024x2.xyz/1024x2/vexnc.git
				synced 2025-10-31 02:24:32 +01:00 
			
		
		
		
	Initial kermit
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| vexnc | ||||
| compile_commands.json | ||||
							
								
								
									
										7
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| LIBS := $(shell pkg-config --cflags --libs libvncserver) -lm -Ivendor/ | ||||
|  | ||||
| vexnc: vexnc.c | ||||
| 	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) | ||||
|  | ||||
| clean: | ||||
| 	rm vexnc | ||||
							
								
								
									
										2
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| # vexnc | ||||
| Single-purpose VNC server that simply displays a static image to all clients. | ||||
							
								
								
									
										7988
									
								
								stb_image.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7988
									
								
								stb_image.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										33
									
								
								vexnc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								vexnc.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| // gcc -O2 -march=native -o vexnc vexnc.c -lvncserver -lm | ||||
|  | ||||
| #include <rfb/rfb.h> | ||||
|  | ||||
| #define STB_IMAGE_IMPLEMENTATION | ||||
| #include "stb_image.h" | ||||
|  | ||||
| int main(int argc, char const *argv[]) { | ||||
|   if (argc < 3) { | ||||
|     printf("usage: %s IMAGEFILE TITLE\n", argv[0]); | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   int imx, imy, imc; | ||||
|   unsigned char *im = stbi_load(argv[1], &imx, &imy, &imc, 4); | ||||
|   if (im == NULL) { | ||||
|     printf("bad image: %s\n", stbi_failure_reason()); | ||||
|     return 1; | ||||
|   } | ||||
|  | ||||
|   rfbScreenInfoPtr rfbScreen = rfbGetScreen(NULL, NULL, imx, imy, 8, 3, 4); | ||||
|   rfbScreen->desktopName = argv[2] ? argv[2] : ""; | ||||
|   rfbScreen->frameBuffer = (char*)im; | ||||
|   rfbScreen->alwaysShared = TRUE; | ||||
|  | ||||
|   rfbInitServer(rfbScreen); | ||||
|   rfbRunEventLoop(rfbScreen, -1, FALSE); | ||||
|  | ||||
|   stbi_image_free(im); | ||||
|   rfbScreenCleanup(rfbScreen); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user