[WIN32K:NTUSER]
[reactos.git] / reactos / win32ss / user / ntuser / main.c
index 0da71f8..f9aed03 100644 (file)
@@ -134,7 +134,6 @@ UserProcessCreate(PEPROCESS Process)
     InitializeListHead(&ppiCurrent->DriverObjListHead);
     ExInitializeFastMutex(&ppiCurrent->DriverObjListLock);
 
-    ppiCurrent->KeyboardLayout = W32kGetDefaultKeyLayout();
     {
         PKEVENT Event;
 
@@ -677,6 +676,9 @@ error:
     return Status;
 }
 
+VOID
+UserDisplayNotifyShutdown(PPROCESSINFO ppiCurrent);
+
 NTSTATUS
 NTAPI
 ExitThreadCallback(PETHREAD Thread)
@@ -706,6 +708,8 @@ ExitThreadCallback(PETHREAD Thread)
     ptiCurrent->TIF_flags |= TIF_DONTATTACHQUEUE;
     ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
 
+    UserCloseClipboard();
+
     /* Decrement thread count and check if its 0 */
     ppiCurrent->cThreads--;
 
@@ -806,6 +810,11 @@ ExitThreadCallback(PETHREAD Thread)
        gptiForeground = NULL;
     }
 
+    /* Restore display mode when we are the last thread, and we changed the display mode */
+    if (ppiCurrent->cThreads == 0)
+        UserDisplayNotifyShutdown(ppiCurrent);
+
+
     // Fixes CORE-6384 & CORE-7030.
 /*    if (ptiLastInput == ptiCurrent)
     {
@@ -990,6 +999,8 @@ DriverEntry(
     NT_ROF(InitTimerImpl());
     NT_ROF(InitDCEImpl());
 
+    gusLanguageID = UserGetLanguageID();
+
     /* Initialize FreeType library */
     if (!InitFontSupport())
     {
@@ -997,8 +1008,6 @@ DriverEntry(
         return Status;
     }
 
-    gusLanguageID = UserGetLanguageID();
-
     return STATUS_SUCCESS;
 }