Skip to content

Commit

Permalink
发布自行编译的版本(虚拟屏幕数 5 个,快捷键已修改)
Browse files Browse the repository at this point in the history
  • Loading branch information
pimgeek committed Oct 30, 2015
1 parent 8b6f784 commit 9619fe3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ OBJS=$(SRCS:.c=.o)
CFLAGS=-O3 -nostdlib -fno-asynchronous-unwind-tables -fno-builtin -fno-ident -ffunction-sections -fdata-sections -Wall
LIBS=-lgdi32 -luser32 -lshell32 -lkernel32
LDFLAGS=-static -nostdlib -fno-builtin -s -Wl,-e,__main,--gc-sections,-subsystem,windows $(LIBS)
ARCH=32
ARCH=64
ifeq ($(ARCH), 64)
WINDRES_ARCH=pe-x86-64
else
WINDRES_ARCH=pe-i386
endif
NAME=virgo
EXE=$(NAME).exe
CC=x86_64-w64-mingw32-gcc

.PHONY: all clean
all: $(EXE)
$(EXE): $(OBJS) $(NAME).res
$(CC) -o $(EXE) $(OBJS) $(NAME).res -m$(ARCH) $(LDFLAGS)

$(NAME).res: $(NAME).rc
windres -O coff -F $(WINDRES_ARCH) $(NAME).rc $(NAME).res
x86_64-w64-mingw32-windres -O coff -F $(WINDRES_ARCH) $(NAME).rc $(NAME).res

.c.o:
$(CC) -o $@ $(CFLAGS) -m$(ARCH) -c $<
Expand Down
12 changes: 6 additions & 6 deletions virgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern __stdcall void RtlMoveMemory(void *, void *, size_t);
#define MOD_NOREPEAT 0x4000
#endif

#define NUM_DESKTOPS 4
#define NUM_DESKTOPS 5

typedef struct {
HWND *windows;
Expand Down Expand Up @@ -195,7 +195,7 @@ static int is_valid_window(HWND hwnd)
static void register_hotkey(int id, int mod, int vk)
{
if(!RegisterHotKey(NULL, id, mod, vk)) {
MessageBox(NULL, "could not register hotkey", "error",
MessageBox(NULL, "无法注册键盘快捷键", "error",
MB_ICONEXCLAMATION);
ExitProcess(1);
}
Expand Down Expand Up @@ -252,8 +252,8 @@ static void virgo_toggle_hotkeys(Virgo *v)
v->handle_hotkeys = !v->handle_hotkeys;
if(v->handle_hotkeys) {
for(i=0; i<NUM_DESKTOPS; i++) {
register_hotkey(i*2, MOD_ALT|MOD_NOREPEAT, i+1+0x30);
register_hotkey(i*2+1, MOD_CONTROL|MOD_NOREPEAT, i+1+0x30);
register_hotkey(i*2, MOD_CONTROL|MOD_SHIFT|MOD_NOREPEAT, i+1+0x30);
register_hotkey(i*2+1, MOD_CONTROL|MOD_ALT|MOD_NOREPEAT, i+1+0x30);
}
} else {
for(i=0; i<NUM_DESKTOPS; i++) {
Expand All @@ -268,8 +268,8 @@ static void virgo_init(Virgo *v)
int i;
v->handle_hotkeys = 1;
for(i=0; i<NUM_DESKTOPS; i++) {
register_hotkey(i*2, MOD_ALT|MOD_NOREPEAT, i+1+0x30);
register_hotkey(i*2+1, MOD_CONTROL|MOD_NOREPEAT, i+1+0x30);
register_hotkey(i*2, MOD_CONTROL|MOD_SHIFT|MOD_NOREPEAT, i+1+0x30);
register_hotkey(i*2+1, MOD_CONTROL|MOD_ALT|MOD_NOREPEAT, i+1+0x30);
}
register_hotkey(i*2, MOD_ALT|MOD_CONTROL|MOD_SHIFT|MOD_NOREPEAT, 'Q');
register_hotkey(i*2+1, MOD_ALT|MOD_CONTROL|MOD_SHIFT|MOD_NOREPEAT, 'S');
Expand Down

0 comments on commit 9619fe3

Please sign in to comment.