soc.2009.vulture: e609da9d: Message loop and empty buddy-list window...
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Mon May 25 17:15:42 EDT 2009
-----------------------------------------------------------------
Revision: e609da9de37a0dda998591037bcfa294343687b1
Ancestor: 768b5d57a18b75ea6a8f9193c297e2305c3576c1
Author: gdick at soc.pidgin.im
Date: 2009-05-25T21:10:35
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/e609da9de37a0dda998591037bcfa294343687b1
Added files:
vulture/blist.c vulture/blist.h
Modified files:
vulture/Makefile.mingw vulture/vulture.c
ChangeLog:
Message loop and empty buddy-list window.
-------------- next part --------------
============================================================
--- vulture/blist.c c833f6ebe0d523cc2c982d8ee4733b0b1aa830d8
+++ vulture/blist.c c833f6ebe0d523cc2c982d8ee4733b0b1aa830d8
@@ -0,0 +1,111 @@
+/*
+ * Vulture - Win32 libpurple client
+ *
+ * blist.c: Buddy list.
+ *
+ * Copyright (C) 2009, Gregor Dick <gdick at soc.pidgin.im>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#include <windows.h>
+
+#include "vulture.h"
+#include "blist.h"
+
+
+static LRESULT CALLBACK BuddyListProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+
+
+static HWND g_hwndBuddyList = NULL;
+
+
+/**
+ * Creates the buddy list.
+ *
+ * @param iCmdShow Initial window state. Cf. ShowWindow.
+ *
+ * @return Zero on success; non-zero on error.
+ */
+int VultureCreateBuddyList(int iCmdShow)
+{
+ const TCHAR c_szClassName[] = TEXT("VULTUREBLIST");
+
+ WNDCLASSEX wndclassex;
+
+ if(g_hwndBuddyList)
+ return 1;
+
+ wndclassex.cbClsExtra = 0;
+ wndclassex.cbSize = sizeof(wndclassex);
+ wndclassex.cbWndExtra = 0;
+ wndclassex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
+ wndclassex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclassex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wndclassex.hIconSm = LoadImage(NULL, IDI_APPLICATION, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED);
+ wndclassex.hInstance = g_hInstance;
+ wndclassex.lpfnWndProc = BuddyListProc;
+ wndclassex.lpszClassName = c_szClassName;
+ wndclassex.lpszMenuName = NULL;
+ wndclassex.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
+
+ if(!RegisterClassEx(&wndclassex))
+ return 2;
+
+ g_hwndBuddyList = CreateWindowEx(
+ WS_EX_OVERLAPPEDWINDOW,
+ c_szClassName,
+ cg_szAppName,
+ WS_OVERLAPPEDWINDOW,
+
+ /* TODO: Read geometry from preferences. */
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ 280, 500,
+
+ NULL,
+ NULL,
+ g_hInstance,
+ NULL);
+
+ if(!g_hwndBuddyList)
+ return 3;
+
+ ShowWindow(g_hwndBuddyList, iCmdShow);
+
+ return 0;
+}
+
+
+/**
+ * Buddy-list window procedure.
+ *
+ * @param hwnd Buddy-list handle.
+ * @param uiMsg Message ID.
+ * @param wParam Message-specific.
+ * @param lParam Message-specific.
+ *
+ * @return Message-specific.
+ */
+static LRESULT CALLBACK BuddyListProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uiMsg)
+ {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+ }
+
+ return DefWindowProc(hwnd, uiMsg, wParam, lParam);
+}
============================================================
--- vulture/blist.h e2472be02ecfeeef66940c5d07b205bb583e6620
+++ vulture/blist.h e2472be02ecfeeef66940c5d07b205bb583e6620
@@ -0,0 +1,28 @@
+/*
+ * Vulture - Win32 libpurple client
+ *
+ * blist.h: Buddy list.
+ *
+ * Copyright (C) 2009, Gregor Dick <gdick at soc.pidgin.im>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#ifndef _VULTURE_BLIST_H_
+#define _VULTURE_BLIST_H_
+
+int VultureCreateBuddyList(int iCmdShow);
+
+#endif
============================================================
--- vulture/Makefile.mingw 05721191bb83f11c7f64405fd6933733339067bd
+++ vulture/Makefile.mingw 496be4f1917cc9baa264fddb5a5c3c94268a98ef
@@ -51,7 +51,8 @@ VULTURE_C_SRC = \
## SOURCES, OBJECTS
##
VULTURE_C_SRC = \
- vulture.c
+ vulture.c \
+ blist.c
# VULTURE_RC_SRC = win32/pidgin_dll_rc.rc
VULTURE_OBJECTS = $(VULTURE_C_SRC:%.c=%.o) $(VULTURE_RC_SRC:%.rc=%.o)
@@ -60,15 +61,11 @@ VULTURE_OBJECTS = $(VULTURE_C_SRC:%.c=%.
## LIBRARIES
##
-PIDGIN_LIBS = \
+VULTURE_LIBS = \
-lglib-2.0 \
-lpurple \
-lwinmm
-# -lintl \
-# -lgobject-2.0 \
-# -lgthread-2.0 \
-
include $(PIDGIN_COMMON_RULES)
##
============================================================
--- vulture/vulture.c 0742db3f7d10914c283478527d69d2f28d1d91eb
+++ vulture/vulture.c eb6152f146d96bfe47df224a1f85fb1e405e6a19
@@ -1,6 +1,8 @@
/*
* Vulture - Win32 libpurple client
*
+ * vulture.c: Entry point and utility functions.
+ *
* Copyright (C) 2009, Gregor Dick <gdick at soc.pidgin.im>
*
* This program is free software; you can redistribute it and/or modify
@@ -21,8 +23,37 @@
#include <windows.h>
+#include "vulture.h"
+#include "blist.h"
+
+HINSTANCE g_hInstance;
+const TCHAR cg_szAppName[] = TEXT("Vulture");
+
+
+/**
+ * Entry point.
+ *
+ * @param hinst Instance handle.
+ * @param hinstPrev Always NULL.
+ * @param szCmdLine Complete command-line, in ANSI.
+ * @param iCmdShow Initial window state. Cf. ShowWindow.
+ *
+ * @return Exit code.
+ */
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR szCmdLine, int iCmdShow)
{
- return 0;
+ MSG msg;
+
+ g_hInstance = hinst;
+
+ VultureCreateBuddyList(iCmdShow);
+
+ while(GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return msg.wParam;
}
More information about the Commits
mailing list