win32: Define COBJMACROS via project argument

We use it everywhere, so it makes sense to enable it everywhere.

For anyone not in the know, defining COBJMACROS makes Micrsoft headers
for COM objects provide C macros so that instead of having to call
  foo->lpVtbl->Release();
to unref a COM object, one can call
  IFoo_Release (foo);

Note that thes macros are implemented with inheritance as Release()
is defined on the IUnknown base interface (MS' equivalent to GObject)
and would otherwise require
  IUnknown_Release ((IUnknown *) foo);
That line works, too - but it is not necessary.
This commit is contained in:
Benjamin Otte 2024-11-03 03:46:53 +01:00
parent ef839e6505
commit 2ed6867084
8 changed files with 2 additions and 14 deletions

View File

@ -267,9 +267,6 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
#include <string.h>
#include <stdlib.h>
/* For C-style COM wrapper macros */
#define COBJMACROS
/* for CIDA */
#include <shlobj.h>

View File

@ -28,7 +28,6 @@
#include "gdkglversionprivate.h"
/* Used for active language or text service change notifications */
#define COBJMACROS
#include <msctf.h>
#ifdef HAVE_EGL

View File

@ -192,9 +192,6 @@
#define INITGUID
#endif
/* For C-style COM wrapper macros */
#define COBJMACROS
#include "gdkdrag.h"
#include "gdkprivate-win32.h"
#include "gdkwin32.h"

View File

@ -36,9 +36,6 @@
#define INITGUID
#endif
/* For C-style COM wrapper macros */
#define COBJMACROS
#include "gdkdropprivate.h"
#include "gdkdrag.h"

View File

@ -28,7 +28,6 @@
#endif
#define WINVER 0x0603
#define _WIN32_WINNT 0x0603
#define COBJMACROS
#include "config.h"
#include <gdk/gdk.h>

View File

@ -19,8 +19,6 @@
#include "config.h"
#define COBJMACROS
#include "gtkfilechoosernativeprivate.h"
#include "gtknativedialogprivate.h"

View File

@ -16,8 +16,8 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#define COBJMACROS
#include "config.h"
#include <math.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>

View File

@ -63,6 +63,7 @@ add_project_arguments('-D_GNU_SOURCE', language: 'c')
if host_machine.system() == 'windows'
add_project_arguments(['-DUNICODE',
'-D_UNICODE',
'-DCOBJMACROS',
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7'], language: 'c')
endif